Skip to main content
Sentry CLI integrates with Seer AI to provide automated root cause analysis and solution planning for issues. The AI analyzes your error data, stack traces, and code context to identify what caused the issue and suggest how to fix it.

Prerequisites

  • GitHub integration configured for your organization
  • Code mappings set up for your project
  • Seer AI enabled in your organization settings
Seer AI is available on Business and Enterprise plans. Visit your organization’s Settings > Seer to enable it.

Commands

Explain: Root Cause Analysis

The issue explain command analyzes an issue and identifies the root cause:
sentry issue explain 123456789
The analysis provides:
  • Identified root causes
  • Reproduction steps
  • Relevant code locations
$ sentry issue explain 123456789
 Analyzing issue...

## Root Cause Analysis Complete

### Cause #0: Null pointer exception in user authentication

**Repository:** my-org/my-app

**Reproduction steps:**

**Authentication flow when email is missing**

The code attempts to access the email property without checking
if the user object exists:

```python
def authenticate_user(user):
    return user.email.lower()  # user could be None
To create a plan, run: sentry issue plan 123456789
</Tab>
<Tab title="JSON Output">
```bash
$ sentry issue explain 123456789 --json
[
  {
    "description": "Null pointer exception in user authentication",
    "relevant_repos": ["my-org/my-app"],
    "root_cause_reproduction": [
      {
        "title": "Authentication flow when email is missing",
        "code_snippet_and_analysis": "The code attempts to access the email property without checking if the user object exists:\n\n```python\ndef authenticate_user(user):\n    return user.email.lower()  # user could be None\n```"
      }
    ]
  }
]

Issue ID Formats

You can reference issues in multiple ways:
# Numeric ID
sentry issue explain 123456789

# Organization/short ID
sentry issue explain sentry/EXTENSION-7

# Project + suffix
sentry issue explain cli-G

# Short ID (searches across orgs)
sentry issue explain CLI-G

Force Fresh Analysis

Use --force to trigger a new analysis even if one exists:
sentry issue explain 123456789 --force

Plan: Solution Generation

The issue plan command generates a solution plan with implementation steps:
sentry issue plan 123456789 --cause 0
The plan command automatically runs root cause analysis if needed, so you don’t need to run explain first.
$ sentry issue plan 123456789 --cause 0
Creating plan for cause #0...
"Null pointer exception in user authentication"

 Generating solution...

## Solution

**Summary:** Add null check before accessing user.email property

### Steps to implement

1. **Add user validation in authenticate_user**

   Update the authenticate_user function to check if user is None
   before accessing the email property. Return a default value or
   raise an appropriate exception.

2. **Add unit tests for null user case**

   Create test cases to verify the function handles None users
   correctly without throwing unhandled exceptions.

3. **Update caller code to handle exceptions**

   Ensure all callers of authenticate_user are prepared to handle
   the authentication failure cases appropriately.

Selecting a Root Cause

If multiple root causes are identified, you must specify which one to plan for:
# If you try without --cause when multiple exist:
$ sentry issue plan 123456789
Error: Multiple root causes found. Please specify one with --cause <id>:

  0: Null pointer exception in user authentication...
  1: Missing rate limiting on authentication endpoint...

Example: sentry issue plan 123456789 --cause 0
Then specify the cause ID:
sentry issue plan 123456789 --cause 0

Regenerate a Plan

Use --force to create a new plan even if one exists:
sentry issue plan 123456789 --cause 0 --force

Scripting with JSON Output

Both commands support --json for automation:
#!/bin/bash
ISSUE_ID="123456789"
ROOT_CAUSES=$(sentry issue explain "$ISSUE_ID" --json)
COUNT=$(echo "$ROOT_CAUSES" | jq 'length')
echo "Found $COUNT root causes"

Troubleshooting

Seer Not Enabled

If you see an error about Seer not being enabled:
Error: Seer is not enabled for this organization.
Enable it at: https://sentry.io/settings/your-org/seer/
Visit your organization settings to enable Seer AI.

No Budget Remaining

Error: Your organization has exceeded its Seer budget for this billing period.
Contact your billing admin or wait for the next billing cycle.

GitHub Integration Required

Error: GitHub integration must be configured for your organization.
Seer requires GitHub integration and code mappings to analyze your code:
  1. Install the GitHub integration in Settings > Integrations
  2. Configure code mappings in your project settings
  3. Try the command again

Analysis Takes Too Long

The first analysis may take several minutes. Progress is shown with a spinner:
 Analyzing issue...
If it times out, try again - subsequent analyses use cached results and complete faster.

Build docs developers (and LLMs) love