Skip to content
Docs GitHub

Features

The Sentry CLI includes several features designed to streamline your workflow, especially in complex project setups.

DSN Auto-Detection

The CLI automatically detects your Sentry project from your codebase, eliminating the need to specify --org and --project flags for every command.

How It Works

DSN detection follows this priority order (highest first):

  1. Source code - Explicit DSN in Sentry.init() calls
  2. Environment files - .env.local, .env, etc.
  3. Environment variable - SENTRY_DSN

When a DSN is found, the CLI resolves it to your organization and project, then caches the result for fast subsequent lookups.

Supported Languages

The CLI can detect DSNs from source code in these languages:

LanguageFile ExtensionsDetection Pattern
JavaScript/TypeScript.js, .ts, .jsx, .tsx, .mjs, .cjsSentry.init({ dsn: "..." })
Python.pysentry_sdk.init(dsn="...")
Go.gosentry.Init(sentry.ClientOptions{Dsn: "..."})
Java.javaSentry.init(options -> options.setDsn("..."))
Ruby.rb`Sentry.init {
PHP.php\Sentry\init(['dsn' => '...'])

Caching

To avoid scanning your codebase on every command, the CLI caches:

  • DSN location - Which file contains the DSN
  • Resolved project - The org/project slugs from the API

The cache is validated on each run by checking if the source file still contains the same DSN. If the DSN changes or the file is deleted, a full scan is triggered.

Usage

Once your project has a DSN configured, commands automatically use it:

Terminal window
# Instead of:
sentry issue list --org my-org --project my-project
# Just run:
sentry issue list

The CLI will show which project was detected:

Detected project: my-app (from .env)
ID SHORT ID TITLE COUNT
123456789 MYAPP-ABC TypeError: Cannot read prop... 142

Monorepo Support & Alias System

In monorepos with multiple Sentry projects, the CLI generates short aliases for each project, making it easy to work with issues across projects.

How Aliases Work

When you run sentry issue list, the CLI:

  1. Scans for DSNs in monorepo directories (packages/, apps/, etc.)
  2. Generates unique short aliases for each project
  3. Caches the aliases for use with other commands

Aliases are the shortest unique prefix of each project slug. For example:

Project SlugAlias
frontendf
functionsfu
backendb

For projects with a common prefix (like spotlight-electron, spotlight-website), the prefix is stripped first:

Project SlugAlias
spotlight-electrone
spotlight-websitew
spotlight-backendb

Using Alias-Suffix Format

After running issue list, you can reference issues using the alias-suffix format:

Terminal window
# List issues - note the ALIAS column
sentry issue list
ALIAS SHORT ID TITLE COUNT
e SPOTLIGHT-ELEC-4Y TypeError: Cannot read prop... 142
w SPOTLIGHT-WEB-ABC Failed to fetch user data 89
b SPOTLIGHT-BACK-XYZ Connection timeout 34
Terminal window
# View issue using alias-suffix
sentry issue view e-4Y
# Explain using alias-suffix
sentry issue explain w-ABC
# Works with any issue command
sentry issue plan b-XYZ

Cross-Organization Support

If you work with multiple organizations that have projects with the same slug, the CLI uses org-prefixed aliases:

ALIAS SHORT ID TITLE
o1:api ORG1-API-123 Error in API handler
o2:api ORG2-API-456 Database connection failed

Issue ID Formats

The CLI accepts several formats for identifying issues:

Numeric ID

The internal Sentry issue ID:

Terminal window
sentry issue view 123456789
sentry issue explain 987654321

Full Short ID

The project-prefixed short ID shown in Sentry UI:

Terminal window
sentry issue view MYPROJECT-ABC
sentry issue explain FRONTEND-XYZ

Short Suffix

Just the suffix portion when --project context is provided:

Terminal window
sentry issue view ABC --org my-org --project myproject

Alias-Suffix

The short alias plus suffix, available after running issue list:

Terminal window
# First, list issues to populate the alias cache
sentry issue list
# Then use alias-suffix format
sentry issue view e-4Y
sentry issue explain w-ABC
sentry issue plan b-XYZ

This format is especially useful in monorepos where you’re working across multiple projects.

AI-Powered Analysis with Seer

The CLI integrates with Sentry’s Seer AI to provide root cause analysis and fix plans directly in your terminal.

Root Cause Analysis

Use sentry issue explain to understand why an issue is happening:

Terminal window
sentry issue explain MYPROJECT-ABC

Seer analyzes:

  • Stack traces and error messages
  • Related events and patterns
  • Your codebase (via GitHub integration)

And provides:

  • Detailed root cause explanation
  • Reproduction steps
  • Relevant code locations

Fix Plans

After understanding the root cause, use sentry issue plan to get actionable fix steps:

Terminal window
sentry issue plan MYPROJECT-ABC

The plan includes:

  • Specific files to modify
  • Code changes to make
  • Implementation guidance

Requirements

For Seer integration to work, you need:

  1. Seer enabled for your organization
  2. GitHub integration configured with repository access
  3. Code mappings set up to link stack frames to source files

See Sentry’s Seer documentation for setup instructions.