Skip to content

[Bug] Desktop app crashes on launch after macOS 27 upgrade (DesktopLocalEnvironmentAuthSessionBootstrapError) #12918

Description

@jamesvillarrubia

Area

apps/desktop

Steps to reproduce

  1. On macOS 27 (Build 26A428), build and launch the T3 Code desktop app (pnpm build:desktop && pnpm start:desktop).
  2. The app attempts to bootstrap the primary local environment on launch.
  3. The main-process /oauth/token exchange over loopback hits a transient failure (connection reset / brief 503 while the backend settles — newly common after the macOS 27 upgrade).
  4. The renderer crashes to the root error view during beforeLoad.

Expected behavior

The app boots to the chat view (or the pairing UI if unauthenticated), riding out the transient loopback failure.

Actual behavior

The app crashes to RootRouteErrorView with PrimaryEnvironmentRequestError caused by DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session. No recovery path; relaunch may work if the transient condition has cleared.

Impact

Blocks work completely

Version or commit

main (pre-fix)

Environment

macOS 27.0 (Build 26A428), desktop app, Node v23.10.0

Logs or stack traces

PrimaryEnvironmentRequestError
  ← DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session
  ← RemoteEnvironmentAuthUndeclaredStatusError (503) | RemoteEnvironmentAuthFetchError | TypeError

Workaround

Relaunch after the transient condition clears. No in-app recovery.

Activity

  1. juliusmarminge commented on Sep 21, 2026

    @juliusmarminge
    Member

    Triage

    Confirmed on current main. This is a real launch-blocking desktop bug. Not a duplicate of #3513 (related brick path, different trigger). A fix PR is already open.

    What happens

    Desktop launch bootstraps the primary local environment by exchanging the desktop bootstrap token for a bearer session, then probing /api/auth/session from the renderer during root beforeLoad.

    On desktop that session call first asks the main process for a bearer token. The main process POSTs loopback /oauth/token once. A brief 503, connection reset, or TypeError (reported as more common after the macOS 27 upgrade) becomes DesktopLocalEnvironmentAuthSessionBootstrapError with no retry.

    That failure is returned over IPC. The renderer wraps it as PrimaryEnvironmentRequestError (fetch-session-state). The inner 503 is not visible after IPC, so the wrapper is labeled HTTP 500 and retryTransientBootstrap does not retry it. bootstrapServerAuth() awaits that first fetchSessionState() outside its try/catch, so the throw escapes beforeLoad and RootRouteErrorView is shown.

    Relaunch can succeed once the backend has settled. After #11291, Try again re-runs beforeLoad and may recover if the transient has cleared; it does not prevent the first-launch crash.

    Source

    Crash chain:

    1. apps/web/src/routes/__root.tsx beforeLoad → resolveInitialServerAuthGateState()
    2. apps/web/src/environments/primary/auth.ts bootstrapServerAuth() → unguarded fetchSessionState()
    3. apps/web/src/environments/primary/httpLayer.ts / desktopAuth.ts → getLocalEnvironmentBearerToken()
    4. apps/desktop/src/ipc/methods/window.ts → DesktopLocalEnvironmentAuth.getBearerToken
    5. apps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts → single bootstrapRemoteBearerSession (no retry)
    6. packages/client-runtime/src/authorization/remote.ts + packages/client-runtime/src/rpc/http.ts → /oauth/token 503/reset/TypeError

    The cookie-exchange path in the renderer already retries 502/503/504 and degrades exchange failures to requires-auth. The desktop bearer path does not.

    This is a desktop reliability gap, not a macOS-only code path. macOS 27 is the reported trigger (loopback timing while the backend settles).

    Related

    Suggested next step

    Review/merge #12919. No second PR needed. After merge, this issue should close via the existing Fixes #12918 line. Leave #3513 open for the remaining degrade/diagnosability work.

  2. added
    acceptedfeature request accepted
    bugSomething is broken or behaving incorrectly.
    via-triageFiled through npx t3 triage
    on Sep 21, 2026
  3. siddham-jain commented on Sep 27, 2026

    @siddham-jain

    Also hitting this on macOS 26.6.2 (25G83) with T3 Code 0.0.42, so it's not limited to macOS 27. Same chain on launch: PrimaryEnvironmentRequestError caused by Error invoking remote method 'desktop:get-local-environment-bearer-token': DesktopLocalEnvironmentAuthSessionBootstrapError: Failed to create the local desktop bearer session.

  4. SamiBahri commented on Oct 5, 2026

    @SamiBahri

    Error still in 0.0.45 - deleting everything and reinstall doesn't help, the app says "MacBook Pro is not connected." when trying to open a local folder as new project for a local environment.

  5. JorgeMenaDev commented on Oct 6, 2026

    @JorgeMenaDev

    Still hitting this on T3 Code (Nightly) 0.0.46-nightly.20261005.2702, macOS 27.0.1 (26A434), on a normal app restart. Same chain: PrimaryEnvironmentRequestError ← desktop:get-local-environment-bearer-token ← DesktopLocalEnvironmentAuthSessionBootstrapError. Relaunching recovered it. Looking forward to #12919 landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions