Debug using the Lightrun Autonomous Debugger in JetBrains¶
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 tab in the Lightrun JetBrains 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.
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 JetBrains IDEs, ensure the following:
- The Lightrun plugin is installed in your local IntelliJ instance.
- You are authenticated in IntelliJ 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:
- In the Jetbrains Lightrun plugin, click the AI tab.
-
Click
and select Reindex Project.
A message confirms successful indexing.
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 JetBrains 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 located next to the Submit button.
-
In the Lightrun plugin, go to the AI tab and click on the Bug tab.
To get quick guidance on how to phrase your prompt, click
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.
-
Click Submit.
The Autonomous Debugger will automatically switch to the Suggestions tab and indicate that it is collecting context and generating hypotheses.
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.
- Skim through the hypothesis summaries.
-
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.
-
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.
-
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.
-
Click the relevant hypothesis and go to the Files section.
As displayed in the following example of a Log Suggestion.
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.
-
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.
-
Select the Source, adjust the settings as needed, and click Save.
Adding the suggested action replaces the icon with the standard Lightrun action icon.
Manage the Autonomous Debugger¶
he Autonomous Debugger is preconfigured with default settings—no changes are required to start debugging. You can optionally modify analysis or indexing settings based on your needs. The AI Models tab is managed by your organization’s administrators. For more details, see the [Lightrun Autonomous Debugger admin guide].
Reset the current session¶
To reset the current debugging session, including the issue description and related suggestions.
-
In the AI tab, click the
icon.
-
Click Reset Session. The session is cleared.
Modify issue analysis settings¶
- Click the Issue Analysis tab to access the settings.
The Issue Analysis tab includes the following fields:
Setting Description Max number of hypotheses Specifies the maximum number of hypotheses the debugger can generate. Increasing this number uses more resources but increases the potential causes for the bug. The debugger may generate fewer hypotheses than the maximum number set. The default is set to 3 hypotheses. Response timeout Specifies the maximum time to wait for the analysis of an issue before timing out. The default is set to 120 seconds.
- Click Save to apply the changes.
Modify code indexing settings¶
-
Click the Code Index tab to access the settings.
The Code Index tab includes the following fields:
Setting Description Max code index size 512 MB. Code include paths Add additional codebases (e.g., external dependencies or services) to the debugger's context. Absolute directory paths must be provided, and multiple paths can be separated by commas. Code exclude paths Ignore the files matching specified patterns when creating the initial debugger context. Supports glob expressions, such as:
•*.txt
: Excludes all files ending with.txt
.
•test
: Excludes files in any directory namedtest
, but does not exclude directories liketests
orunit_test
.
•*test
: Excludes the entireunit_test
directory. -
Click Save to apply the changes.