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]: Could not prepare the SSH environment: Error invoking remote method 'desktop:bootstrap-ssh-bearer-session': DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session. #21681
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Could not prepare the SSH environment: Error invoking remote method 'desktop:bootstrap-ssh-bearer-session': DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session.
Add a normal Arch linux machine over ssh
node and bun are installed over mise
ssh works fine, herdr, zed, vs code remotes work fine
npx t3 on the machine itself works fine
Expected behavior
it installs current t3 code and connects to the server
Actual behavior
Could not prepare the SSH environment: Error invoking remote method 'desktop:bootstrap-ssh-bearer-session': DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session.
changed the title [-][Bug]:[/-][+][Bug]: `Could not prepare the SSH environment: Error invoking remote method 'desktop:bootstrap-ssh-bearer-session': DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session.`[/+]on Oct 19, 2026
We need more detail to tell why the remote server rejected the pairing credential. A 401 at this step means the remote T3 server answered and refused the credential the desktop created over SSH (sshEnvironment.ts:63-65). So the remote launch and node lookup, including mise, had already worked. The launcher also adds mise shims to PATH (tunnel.ts:387-391).
The launcher reuses a T3 server that is already running from the default home instead of starting its own (tunnel.ts:652-690). It then creates the pairing credential with the launcher's own t3 runner against that default home (tunnel.ts:750-760). A server you started yourself with npx t3 can end up being the one that receives it.
Please reply with:
Whether a t3 server you started yourself was running on the host when you connected, and whether connecting works with it stopped.
The npx t3 version on the host.
The contents of server.log under ~/.t3/ssh-launch on the host.
An older t3 server was already running, manually sshing into the server killing t3 there and doing npx t3 service install fixed the issue. It would be nice if t3 code would show a nicer error message though or would even do this for me.
Same 401 on another host. Here's the diagnosis you asked for above.
What happened
The desktop updated to 0.1.0. After that, an SSH environment showed Reconnecting: Could not prepare the SSH environment on every retry.
Diagnosis
An older server, 0.0.45, was still running from the remote ~/.t3. The launcher adopted it as external and minted the pairing grant with its own 0.1.0 runner. The 0.1.0 CLI writes grants to statev2.sqlite, but the 0.0.45 server reads state.sqlite, so /oauth/token rejected the grant.
On this host nobody started the old server by hand. The desktop had launched it as managed under the state key of the connection's previous alias. After the alias changed, the new key adopted the server as external, so no update would ever replace it.
Steps to reproduce
Derived from the logs and the launch script, not replayed end to end:
Connect an SSH environment with an older desktop and let it launch the remote server.
Change the connection's alias, user, or port, then reconnect. The launch now reports remoteServerKind: "external".
Update the desktop to a release whose CLI writes a different database, such as 0.0.45 → 0.1.0, and reconnect.
Version
Desktop 0.1.0. Remote server 0.0.45, with the 0.1.0 runtime installed next to it by the launcher.
Environment
The desktop runs on Arch Linux under Wayland. The remote is Ubuntu 24.04 x64 with the release-archive runtime and no Node.
Evidence
Desktop trace:
ssh.environment.ensure.succeeded { remotePort: 3773, remoteServerKind: "external", issuedPairingToken: true }
DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session.
[cause]: EnvironmentAuthInvalidError: The environment rejected this client's credentials (invalid_credential).
Remote server trace:
environment.auth.token POST /oauth/token -> EnvironmentAuthInvalidError (invalid_credential)
at environment.auth.token (file:///<home>/.t3/runtime/versions/0.0.45/t3)
On the remote, t3 serve ran from runtime/versions/0.0.45 and held only state.sqlite open, while the launcher's run-t3.sh pinned T3_ARCHIVE_VERSION='0.1.0'. The first pairing attempt with the 0.1.0 CLI created statev2.sqlite. The 0.0.45 server kept writing state.sqlite for about five more hours.
I stopped the 0.0.45 server, moved the stale statev2.sqlite* aside, and let the desktop relaunch. The 0.1.0 server imported the current state.sqlite, and the desktop connected.
If you recovered by stopping the old server, check your data. The new server imports V1 only when statev2.sqlite is missing, so anything written after the first failed pairing is not in V2. state.sqlite is left untouched, so stopping the server, moving statev2.sqlite* aside, and starting it again imports it once more.
Thanks for the report. One part of this is fixed in current main. Merged #17550 mints pairing credentials with the runtime of a reused managed server, fixing the reported old-server credential mismatch. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: a managed server can still be adopted as external after the SSH alias changes. If that part still matters to you, please open a new issue for that part only.
Activity
[-][Bug]:[/-][+][Bug]: `Could not prepare the SSH environment: Error invoking remote method 'desktop:bootstrap-ssh-bearer-session': DesktopSshEnvironmentRequestError: [ssh_http:401] SSH remote API request failed during bootstrap-bearer-session.`[/+]juliusmarminge commentedon Oct 19, 2026
Note
Grok responding on behalf of Julius.
We need more detail to tell why the remote server rejected the pairing credential. A 401 at this step means the remote T3 server answered and refused the credential the desktop created over SSH (sshEnvironment.ts:63-65). So the remote launch and node lookup, including mise, had already worked. The launcher also adds mise shims to PATH (tunnel.ts:387-391).
The launcher reuses a T3 server that is already running from the default home instead of starting its own (tunnel.ts:652-690). It then creates the pairing credential with the launcher's own
t3runner against that default home (tunnel.ts:750-760). A server you started yourself withnpx t3can end up being the one that receives it.Please reply with:
t3server you started yourself was running on the host when you connected, and whether connecting works with it stopped.npx t3version on the host.server.logunder~/.t3/ssh-launchon the host.paperbenni commentedon Oct 19, 2026
An older t3 server was already running, manually sshing into the server killing t3 there and doing npx t3 service install fixed the issue. It would be nice if t3 code would show a nicer error message though or would even do this for me.
Gooder24 commentedon Oct 19, 2026
Same 401 on another host. Here's the diagnosis you asked for above.
What happened
The desktop updated to 0.1.0. After that, an SSH environment showed
Reconnecting: Could not prepare the SSH environmenton every retry.Diagnosis
An older server, 0.0.45, was still running from the remote
~/.t3. The launcher adopted it asexternaland minted the pairing grant with its own 0.1.0 runner. The 0.1.0 CLI writes grants tostatev2.sqlite, but the 0.0.45 server readsstate.sqlite, so/oauth/tokenrejected the grant.On this host nobody started the old server by hand. The desktop had launched it as
managedunder the state key of the connection's previous alias. After the alias changed, the new key adopted the server asexternal, so no update would ever replace it.Steps to reproduce
Derived from the logs and the launch script, not replayed end to end:
remoteServerKind: "external".Version
Desktop 0.1.0. Remote server 0.0.45, with the 0.1.0 runtime installed next to it by the launcher.
Environment
The desktop runs on Arch Linux under Wayland. The remote is Ubuntu 24.04 x64 with the release-archive runtime and no Node.
Evidence
Desktop trace:
Remote server trace:
On the remote,
t3 serveran fromruntime/versions/0.0.45and held onlystate.sqliteopen, while the launcher'srun-t3.shpinnedT3_ARCHIVE_VERSION='0.1.0'. The first pairing attempt with the 0.1.0 CLI createdstatev2.sqlite. The 0.0.45 server kept writingstate.sqlitefor about five more hours.Related issues
managedafter a connection edit, so updates still replace it.Fix applied or workaround
I stopped the 0.0.45 server, moved the stale
statev2.sqlite*aside, and let the desktop relaunch. The 0.1.0 server imported the currentstate.sqlite, and the desktop connected.If you recovered by stopping the old server, check your data. The new server imports V1 only when
statev2.sqliteis missing, so anything written after the first failed pairing is not in V2.state.sqliteis left untouched, so stopping the server, movingstatev2.sqlite*aside, and starting it again imports it once more.Filed by
Claude Opus 5.5 in Claude Code, run from T3 Code.
t3dotgg commentedon Oct 21, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Thanks for the report. One part of this is fixed in current main. Merged #17550 mints pairing credentials with the runtime of a reused managed server, fixing the reported old-server credential mismatch. Please test on the nightly built from main on 2026-10-21, or on the next stable release. One part is still open: a managed server can still be adopted as external after the SSH alias changes. If that part still matters to you, please open a new issue for that part only.