Skip to content

[Bug]: Migration 24 (BackfillProjectionThreadShellSummary) crash-loops backend on pre-existing DB — no window opens #3038

@orchidautomation

Description

@orchidautomation

Summary

On a fresh launch, T3 Code (Alpha) 0.0.27 appears to start (process is alive, Dock icon, "running") but no window ever opens. The root cause is the local backend sidecar crash-looping during DB migrations: migration 24_BackfillProjectionThreadShellSummary fails because of a missing column on a pre-existing state.sqlite, so the backend exits with code 1 repeatedly (500ms → 1s → 2s → 4s backoff) and the renderer/window is never created.

This happens when ~/.t3/userdata/state.sqlite was created by the predecessor "DP Code (Alpha)" build (0.0.25) and is then opened by T3 Code 0.0.27. The shared ~/.t3/userdata directory carries a schema that migration 24 can't apply against.

Environment

  • App: T3 Code (Alpha) 0.0.27 (installed via Homebrew cask t3-code)
  • macOS: Sequoia (Darwin 24.6.0), Apple Silicon (arm64)
  • Pre-existing data dir originally created by DP Code (Alpha) 0.0.25; migrations applied through 23_ProjectionThreadShellSummary (dated 2026-04-12) before the upgrade.

Symptoms

  • ps aux shows the main process + GPU process + network utility helper, but no --type=renderer process → no window.
  • No macOS crash report (the backend child exits cleanly with code 1; the Electron shell stays up waiting).
  • desktop-backend-manager: backend exited unexpectedly; restart scheduled reason: code=1 in a loop.

Exact error (from ~/.t3/userdata/logs/server-child.log)

INFO: Running all migrations...
ERROR: MigrationError: Migration "24_BackfillProjectionThreadShellSummary" failed
  at runMigrations (app.asar/apps/server/dist/bin.mjs:12409:9)
  [cause]: effect/sql/SqlError: Failed to prepare statement
    at NodeSqliteClient-C-seYk0y.mjs:67:23
    [cause]: effect/sql/SqlError/UnknownError: Failed to prepare statement
      [cause]: Error: no such column: latest_user_message_at

Migration 24 references latest_user_message_at on projection_threads, but that column does not exist in a DB last migrated through #23 by the older DP Code build.

Reproduction

  1. Have a ~/.t3/userdata/state.sqlite produced by DP Code (Alpha) 0.0.25 (migrations through 23_ProjectionThreadShellSummary).
  2. Install/launch T3 Code (Alpha) 0.0.27.
  3. Backend runs migrations on startup → migration 24 throws no such column: latest_user_message_at → backend exits code 1 → crash-loop → window never appears.

Workaround (confirmed)

Quit the app, move the DB aside, relaunch:

pkill -i "T3 Code"
mv ~/.t3/userdata/state.sqlite ~/.t3/userdata/state.sqlite.bak
open -a "T3 Code (Alpha)"

A clean DB runs all 32 migrations successfully (Migrations ran successfullyListening on http://127.0.0.1:3773) and the window renders. This loses local thread history.

Suggested fixes

  • Make migration 24 tolerant of a projection_threads table that lacks latest_user_message_at (guard with a column-exists check, or ensure the column is added by an earlier migration in the chain before the backfill runs).
  • Surface backend migration failures in the UI instead of silently crash-looping with no window (e.g. an error screen with the failing migration + a "reset local data" affordance).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions