Skip to content

Debug using the Lightrun Autonomous Debugger in VS Code

Note

Supported from version 1.61 in the VS Code IDE.

The Lightrun Autonomous Debugger, powered by Generative AI, automates runtime debugging directly into your IDE. It streamlines the troubleshooting process from ticket to fix, helping developers quickly pinpoint application issues—even in mission-critical production workloads. For more information, see Lightrun Autonomous Debugger overview.

The Autonomous Debugger is located in the AI Debugger tab in the Lightrun VS Code plugin. It contains two main sub tabs:

  • Bug: Enter a description of your bug.
  • Suggestions: Lightrun AI-generated suggestions based on the bug you report and the project files that were indexed.

VS Code AI Debugger

Before your begin

The Autonomous Debugger requires a few additional setup steps beyond the standard Lightrun plugin. For detailed environment compatibility, see Autonomous Debugger system requirements.

To use the Autonomous Debugger in VS Code, ensure the following:

  • The Lightrun plugin is installed in your local VS Code instance.
  • You are authenticated in VS Code with your Lightrun account.
  • The source Git branch (source branch for the running application) is open in the IDE.

Preliminary stage: Automatic project indexing

Before suggestions can be generated, the Autonomous Debugger must index your open project. This happens automatically when you open a project on the source Git branch. The index is stored locally in the ~/.lightrun folder.

Before the debugger can suggest fixes, it must index your project. Indexing happens automatically for the open Git branch and stores the data in ~/.lightrun.

Switching branches or projects requires manual reindexing.

To reindex manually:

  1. In the VS Code Lightrun plugin, click the AI Debugger tab.
  2. Click Hamburger icon and select Reindex Project.

    Reindex project

    A message confirms successful indexing.

    Index successfully

Debug with the Autonomous Debugger

The Lightrun Autonomous debugger performs real-time code analysis to autonomously identify software issues, following a streamlined incident-response flow. It facilitates the entire process, from ticket to fix, all within the VS Code native environment (IDE).

Step 1: Describe the issue

To get the best results, ensure your prompt is as detailed and focused as possible. The more information you provide, the better the AI can help you identify the root cause of the issue. For tips on optimizing your prompts, refer to our guide on Best practices for prompts in Lightrun Autonomous Debugger.

Tip

To get quick guidance on how to phrase your prompt, click Question mark icon located next to the Submit button.

  1. In the Lightrun plugin, go to the AI Debugger tab and click on the Bug tab.

    To get quick guidance on how to phrase your prompt, click Question mark icon located next to the Submit button.

  2. To start, describe your issue in the Bug tab. You can write your own prompt or paste a ticket description from systems like Jira or ServiceNow.

    Bug description

  3. Click Submit.

    The Autonomous Debugger will automatically switch to the Suggestions tab and indicate that it is collecting context and generating hypotheses.

    AI collecting context

    It will then begin analyzing your issue based on your prompt description, reviewing your indexed projects, and identifying the source code files likely associated with the reported issue.

    Note that this may take some time depending on the number and size of your indexed files.

Step 2: Review suggestions

Once the analysis is complete, the Autonomous Debugger provides up to 3 hypotheses. Each hypothesis includes a possible cause and files likely involved.

Upvote the most relevant hypotheses and downvote those that seem less likely. Your votes will not affect debugging but help improve future recommendations.

The following sample hypotheses are based on the bug description provided in the Step 1.

AI Hypotheses Overview

  1. Skim through the hypothesis summaries.
  2. For a relevant hypothesis, click More details.

    A detailed description appears, showing the code element involved and the reason for the issue.A list of files related to the issue is displayed, along with proposed lines where Lightrun actions can be added to validate the hypothesis.

    Validate Hypotheses

  3. Click Show full analysis to learn more. The Full analysis diaglog includes a detailed breakdown of the issue, root cause analysis, reproduction steps, and possible remediation advice.

    You can click Copy to Clipboard to share the route analysis results with your peers.

  4. Click OK.

Step 3: Remediate the issue with Lightrun Actions

The remediation step begins based on the Autonomous Debugger’s suggested fix. After validating the suggestion, apply the recommended solution to resolve the issue. This may involve making code adjustments or implementing the proposed solution.

To verify the AI's suggestions, use Lightrun actions, such as adding logs, snapshots, or other real-time debugging methods. After applying the fix, the issue is remediated, and the system returns to normal operation, with the incident closed.

To start remediating the issue, return to the Hypothesis Overview view.

  1. Click the relevant hypothesis and go to the Files section.

    As displayed in the following example of a Log Suggestion.

    Copy to Clipboard

    A list of up to 8 debug suggestions are displayed and includes:

    • A list of recommended Lightrun Logs and Snapshots that can be added to specific lines in your code to further debug the issue based on the selected hypothesis.
    • Recommended expressions for gathering relevant information.

    In parallel, Lightrun Suggested action icons appear in the list and in the gutter, indicating a debug suggestion to help validate your hypothesis.

    Log Suggestion icon

  2. Click the relevant Lightrun action that is likely to resolve your issue. In the following example, the Log Suggestion has been selected.

    The Log Suggestion dialog opens and the log details are populated with the relevant expressions to debug your issue.

    Copy to Clipboard

  3. Select the Source, adjust the settings as needed, and click Save.

    Adding the suggested action replaces the icon with the standard Lightrun action icon.

Reset the current session

To reset the current debugging session, including the issue description and related suggestions.

  1. In the AI Debugger tab, click the Hamburger icon icon.

    Reset Session

  2. Click Reset Session.

    The session is cleared.


Last update: June 17, 2025