Skip to main content
The Sentry CLI stores its configuration, authentication tokens, and cached data in a local SQLite database. This page documents the database structure, cache behavior, and file locations.

Database Location

The configuration database is stored at:
  • Linux/macOS: ~/.config/sentry-cli/config.db
  • Windows: %APPDATA%\sentry-cli\config.db
You can override this location by setting the SENTRY_CONFIG_DIR environment variable:

Database Schema

The CLI uses SQLite with a versioned schema system. The current schema version is 8.

Core Tables

schema_version

Tracks the current database schema version for migrations.

auth

Stores OAuth authentication tokens (single-row table).
  • id: Always 1 (enforced by CHECK constraint)
  • token: OAuth access token
  • refresh_token: OAuth refresh token for automatic renewal
  • expires_at: Token expiration timestamp (milliseconds since epoch)
  • issued_at: Token issue timestamp (milliseconds since epoch)
  • updated_at: Last update timestamp (auto-managed)
Token Refresh: Tokens are automatically refreshed when less than 10% of their lifetime remains (configurable via REFRESH_THRESHOLD constant). Default token lifetime is 1 hour.

defaults

Stores default organization and project (single-row table).
  • organization: Default organization slug
  • project: Default project slug
  • updated_at: Last update timestamp (auto-managed)

user_info

Caches authenticated user information (single-row table).

instance_info

Stores a unique instance ID for telemetry (single-row table).

Cache Tables

project_cache

Caches project metadata from the Sentry API.
  • cache_key: Composite key (typically org_slug/project_slug)
  • project_id: Numeric project ID (added in schema version 7)
  • No TTL: Cache entries remain valid indefinitely and are updated on access

dsn_cache

Caches DSN resolution results (maps DSNs to org/project information).
  • source: Detection source (e.g., .env, src/index.js)
  • fingerprint: Content hash for invalidation
  • *_json: JSON-encoded metadata for change detection
  • ttl_expires_at: Time-based expiration (added in schema version 4)

project_root_cache

Caches project root detection results.
  • cwd: Working directory used as cache key
  • reason: Detection method (e.g., .git, package.json)
  • cwd_mtime: Directory modification time for invalidation

project_aliases

Stores short aliases for projects (used in monorepos).

org_regions

Caches organization region URLs (for multi-region support).
  • org_id: Numeric organization ID (added in schema version 8)
  • region_url: Regional API endpoint (e.g., https://us.sentry.io)

pagination_cursors

Caches pagination cursors for --cursor last support.
  • TTL: 5 minutes (ephemeral)
  • Composite primary key: Added in schema version 6

metadata

Generic key-value store for CLI metadata.
Currently used for:
  • Version check timestamps
  • Last upgrade notification

Schema Migrations

The CLI automatically migrates the database schema when you upgrade to a new version.

Migration History

Auto-Repair

If the CLI detects schema issues (missing tables or columns), it automatically repairs them. This is useful when:
  • The database was corrupted
  • A previous migration failed
  • The database was manually modified
To disable auto-repair:

Cache TTLs

The CLI uses different cache strategies for different data types:
  • Authentication tokens: Refreshed when < 10% of lifetime remains (default: 1 hour)
  • Pagination cursors: 5 minutes (hardcoded)
  • Project metadata: No expiration (updated on access)
  • DSN resolution: Content-based invalidation via fingerprints + optional TTL
  • Project root: Content-based invalidation via directory mtime + TTL
  • Organization regions: No expiration (updated on access)

Database Maintenance

Manual Inspection

You can inspect the database using any SQLite client:

Clear All Data

To reset the CLI to a clean state, delete the entire config directory:
The CLI will automatically recreate the database on next run.

Clear Specific Data

Use the sentry auth logout command to clear authentication data (also clears user info, org regions, and pagination cursors):

Database Errors

If you encounter database errors:
  1. Check permissions: Ensure the CLI can write to ~/.config/sentry-cli/
  2. Check disk space: SQLite requires free space for temporary files
  3. Try auto-repair: The CLI will attempt to fix schema issues automatically
  4. Manual reset: Delete the database file and let the CLI recreate it
Common error messages:
  • attempt to write a readonly database: Check file/directory permissions
  • no such table: Schema is corrupted, auto-repair should fix it
  • no such column: Schema is outdated, auto-repair should fix it
See the Troubleshooting page for detailed error solutions.