Database Location
The configuration database is stored at:- Linux/macOS:
~/.config/sentry-cli/config.db - Windows:
%APPDATA%\sentry-cli\config.db
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 tokenrefresh_token: OAuth refresh token for automatic renewalexpires_at: Token expiration timestamp (milliseconds since epoch)issued_at: Token issue timestamp (milliseconds since epoch)updated_at: Last update timestamp (auto-managed)
REFRESH_THRESHOLD constant). Default token lifetime is 1 hour.
defaults
Stores default organization and project (single-row table).organization: Default organization slugproject: Default project slugupdated_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 (typicallyorg_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 detectionttl_expires_at: Time-based expiration (added in schema version 4)
project_root_cache
Caches project root detection results.cwd: Working directory used as cache keyreason: 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.- Version check timestamps
- Last upgrade notification
Schema Migrations
The CLI automatically migrates the database schema when you upgrade to a new version.Migration History
| Version | Changes |
|---|---|
| 1 → 2 | Added org_regions, user_info, instance_info tables |
| 2 → 3 | Added name column to user_info |
| 3 → 4 | Added detection caching columns to dsn_cache, added project_root_cache |
| 4 → 5 | Added pagination_cursors table |
| 5 → 6 | Fixed pagination_cursors composite primary key |
| 6 → 7 | Added project_id column to project_cache |
| 7 → 8 | Added org_id column to org_regions |
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
Cache TTLs
Cache Expiration Strategy
Cache Expiration Strategy
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:Clear Specific Data
Use thesentry auth logout command to clear authentication data (also clears user info, org regions, and pagination cursors):
Database Errors
If you encounter database errors:- Check permissions: Ensure the CLI can write to
~/.config/sentry-cli/ - Check disk space: SQLite requires free space for temporary files
- Try auto-repair: The CLI will attempt to fix schema issues automatically
- Manual reset: Delete the database file and let the CLI recreate it
attempt to write a readonly database: Check file/directory permissionsno such table: Schema is corrupted, auto-repair should fix itno such column: Schema is outdated, auto-repair should fix it