You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Desktop fails to start when state DB migration ids collide with a different build (auth_sessions missing scopes) #21106
Desktop shows PrimaryEnvironmentRequestError … DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session on every launch when the state DB's migration ids were already used by a different build. The app is bricked until the DB is hand-repaired, and the UI error hides the real cause. Same user-visible stack as #17792 (closed; the explanation there was a transient loopback failure, which did not apply here).
Root cause (from server.trace.ndjson)
POST /oauth/token fails with access_token_issuance_failed → AuthSessionRepository.createReplacingActive → table auth_sessions has no column named scopes.
statev2.sqlite was created by importing an older state.sqlite. That DB had migration ids 1–32 recorded as applied, but ids 31/32 there were ProjectionThreadContextBindings / ProjectionTurnsContextBlocks (written by a different, Nightly-labelled build; these names are not in main). In the current build 31/32 are AuthAuthorizationScopes (adds scopes, drops/recreates the auth tables) and AuthPairingProofKeyThumbprint. The migrator keys on id only, so both were treated as done and skipped. Migrations 33+ then applied normally, which is why only the auth tables were stale (auth_sessions had client_surface from 041 but no scopes).
Repro
Have a state DB whose effect_sql_migrations has id 31 under a different name than 031_AuthAuthorizationScopes.
Launch the current desktop build.
Workaround
Quit the app, back up ~/.t3/userdata/statev2.sqlite, then recreate auth_pairing_links and auth_sessions per migrations 031 + 032 (+ the two columns from 041). Existing auth sessions/pairings are lost by design.
Suggested fixes
On import/startup, compare (migration_id, name) against the bundled list and rerun or refuse on a name mismatch instead of trusting ids.
Surface the backend's access_token_issuance_failed reason in the desktop error instead of the generic bootstrap message.
Closing as unsupported database reuse. Migrations 31 and 32 have been AuthAuthorizationScopes and AuthPairingProofKeyThumbprint on main since June, and the names your database recorded for those ids don't appear anywhere in this repo, so it was written by a build we don't ship. The statev2 import copies state.sqlite as-is, migration history included, and the migrator follows ids, only logging a warning when names diverge. Please keep a backup of that database before changing it. Requests to refuse mismatched names for every id, or to show the server's token error in the desktop app, belong in Ideas: https://github.com/pingdotgg/t3code/discussions/new?category=ideas
Activity
juliusmarminge commentedon Oct 18, 2026
Note
Grok responding on behalf of Julius.
Closing as unsupported database reuse. Migrations 31 and 32 have been
AuthAuthorizationScopesandAuthPairingProofKeyThumbprinton main since June, and the names your database recorded for those ids don't appear anywhere in this repo, so it was written by a build we don't ship. The statev2 import copiesstate.sqliteas-is, migration history included, and the migrator follows ids, only logging a warning when names diverge. Please keep a backup of that database before changing it. Requests to refuse mismatched names for every id, or to show the server's token error in the desktop app, belong in Ideas: https://github.com/pingdotgg/t3code/discussions/new?category=ideas