Skip to main content
This guide helps you diagnose and resolve common issues with the Sentry CLI.

Common Issues

Authentication Problems

Cause: The CLI cannot find a valid authentication token.Solutions:
  1. Log in with OAuth:
  2. Use an environment variable:
  3. Use a token file (for CI/CD):
Note: SENTRY_AUTH_TOKEN takes precedence over SENTRY_TOKEN and stored OAuth tokens.
Cause: Your OAuth token has expired and cannot be refreshed.Solutions:
  1. Re-authenticate:
  2. Check token expiration:
  3. Use a non-expiring token (for automation):
    • Go to Sentry → Settings → Account → Auth Tokens
    • Create a new auth token
    • Set SENTRY_AUTH_TOKEN environment variable
Cause: The stored OAuth token expired and there’s no refresh token to renew it.Solution: Re-authenticate using the login command:
This error typically happens if:
  • You manually edited the database
  • The OAuth flow was interrupted
  • The token was created before refresh token support was added

Context Resolution

Cause: The CLI cannot determine which organization to use.Solutions:
  1. Specify explicitly:
  2. Set default organization:
  3. Use DSN detection:
    • Add a Sentry DSN to .env in your project:
    • Or add it to your code (JavaScript example):
  4. Store a default:
Cause: The CLI needs both org and project context but cannot determine them.Solutions:
  1. Specify explicitly:
  2. Set environment variables:
  3. Use DSN detection (see above)
  4. Store defaults:

Database Errors

Cause: The CLI cannot write to its SQLite database due to permission issues.Solutions:
  1. Check file permissions:
  2. Check directory permissions:
  3. Check if filesystem is read-only:
  4. Use a custom config directory:
Cause: The database schema is corrupted or incomplete.Solutions:
  1. Let auto-repair fix it (default behavior):
    • The CLI automatically detects and repairs schema issues
    • Check the logs for “Auto-repaired database” messages
  2. Manual repair:
  3. Reset the database (last resort):
Note: Auto-repair can be disabled with SENTRY_CLI_NO_AUTO_REPAIR=1 (not recommended).
Cause: The database schema is outdated (usually after downgrading the CLI).Solutions:
  1. Upgrade to the latest CLI version:
  2. Let auto-repair add the column (automatic in most cases)
  3. Reset the database:

API Errors

Cause: Authentication failed (invalid or expired token).Solutions:
  1. Check token validity:
  2. Re-authenticate:
  3. Verify token permissions (for auth tokens):
    • Go to Sentry → Settings → Auth Tokens
    • Ensure the token has the required scopes
    • Check if the token is enabled and not expired
Cause: You don’t have permission to access the requested resource.Solutions:
  1. Check organization/project access:
    • Verify you’re a member of the organization
    • Check your role (some commands require admin/owner)
  2. Verify auth token scopes:
    • Org auth tokens may have limited scopes
    • Use a user auth token or re-create the org token with broader scopes
  3. Check if the resource exists:
Cause: The requested resource (org, project, issue, etc.) doesn’t exist or you don’t have access.Solutions:
  1. Verify the resource exists:
  2. Check spelling:
    • Slugs are case-sensitive
    • Use the exact slug from the Sentry web UI
  3. Verify you have access:
    • You may not be a member of the organization
    • The project may be in a different organization

Self-Hosted Sentry

Cause: OAuth device flow requires a client ID for self-hosted Sentry (version 26.1.0+).Solution:
  1. Create an OAuth application:
    • Go to your Sentry instance → Settings → Developer Settings
    • Click “Create New Application”
    • Select “Public” application type
    • Copy the client ID
  2. Set the environment variables:
  3. Log in:
Alternative (for older Sentry versions):

Debugging Techniques

Enable Debug Logging

Get detailed information about what the CLI is doing:
Log levels:
  • error: Only errors
  • warn: Errors and warnings
  • info: Normal output (default)
  • debug: Detailed debugging information
  • trace: Very verbose (includes HTTP requests/responses)

Inspect the Database

Query the SQLite database directly:

Test DSN Detection

Check if the CLI can detect your project’s DSN:

Check Network Connectivity

Verify you can reach the Sentry API:

Verify Token Format

Sentry auth tokens have specific formats:
  • User auth tokens: Start with sntryu_
  • Org auth tokens: Start with sntrys_
  • OAuth access tokens: Random alphanumeric (40+ characters)

Error Message Reference

CliError

Base class for all CLI errors. Generic format:

ApiError

API request failures. Format:
Common Status Codes:
  • 400: Bad request (invalid parameters)
  • 401: Unauthorized (authentication failed)
  • 403: Forbidden (insufficient permissions)
  • 404: Not found
  • 429: Rate limited
  • 500: Internal server error

AuthError

Authentication failures. Reasons:
  • not_authenticated: No valid token found
  • expired: Token has expired
  • invalid: Token is malformed or rejected

ConfigError

Configuration issues. Format:

ContextError

Missing required context (org/project). Format:

ResolutionError

Failed to resolve a resource. Format:

ValidationError

Invalid input. Format:

DeviceFlowError

OAuth device flow failures. Common codes:
  • authorization_pending: User hasn’t authorized yet
  • slow_down: Polling too fast
  • expired_token: Device code expired
  • access_denied: User denied authorization

SeerError

Seer AI feature errors. Reasons:
  • not_enabled: Seer not enabled for the organization
  • no_budget: Requires a paid plan
  • ai_disabled: AI features disabled in organization settings
Format includes actionable URLs:

UpgradeError

CLI upgrade failures. Reasons:
  • unknown_method: Cannot detect installation method
  • unsupported_operation: Operation not supported for this install method
  • network_error: Failed to fetch version info
  • execution_failed: Upgrade command failed
  • version_not_found: Specified version doesn’t exist

Performance Issues

Possible Causes:
  • Network latency to Sentry API
  • Large result sets (e.g., listing thousands of issues)
  • Slow DSN detection (scanning many files)
Solutions:
  1. Use pagination:
  2. Skip DSN detection:
  3. Use regional endpoints (automatic for SaaS):
    • The CLI automatically detects and uses regional APIs
    • Check org_regions table for cached regions
  4. Check network latency:
Possible Causes:
  • Large API responses
  • Caching many projects
Solutions:
  1. Clear caches:
  2. Use streaming mode (for large result sets):

Getting Help

If you’re still experiencing issues:
  1. Check the documentation:
  2. Enable debug logging:
  3. Report a bug:
    • GitHub Issues: github.com/getsentry/sentry-cli
    • Include:
      • CLI version (sentry --version)
      • Operating system
      • Error message and full command
      • Debug logs (with sensitive data redacted)
  4. Get community support: