[BUG] Desktop SSH session + Remote Control: "401 OAuth access token has expired" once the PC sleeps, although the remote host has its own valid login

Status Open
Reported on v2.1.284
Maintainer reply None cached
Activity 0 comments · opened Oct 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet (closest: #94887, #92613, #95262, #81354; see Related issues)
  • [x] This is a single bug report

What's Wrong?

A Claude Code session started from Claude Desktop over SSH, with Remote Control on, stops working as soon as the Desktop app can no longer refresh the OAuth token, typically because the PC went to sleep.

The remote worker (~/.claude/remote/ccd-cli/<version>) does not use the login of the remote host. Desktop passes it a token at spawn time and keeps the refresh for itself. Environment of the live worker (names and non-secret values only):

CLAUDE_CODE_ENTRYPOINT=claude-desktop
CLAUDE_CODE_OAUTH_TOKEN=<set>
CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH=1
CLAUDE_CODE_SDK_HAS_HOST_AUTH_REFRESH=1

So when the token expires while the PC sleeps, nothing can refresh it. The session is still reachable from claude.ai and the mobile app: the message is delivered to the worker and written to the transcript. But the model request fails with a 401, and the session is stuck until the PC wakes up.

The remote host already has its own valid claude.ai login (~/.claude/.credentials.json). On the same host, same user, sessions started by claude remote-control use that login, refresh it on their own and are not affected. On this host: 2 of 16 Desktop SSH sessions hit this error, 0 of 25 claude remote-control sessions did.

What Should Happen?

A session that Remote Control advertises as usable from another device should not depend on the PC staying awake to keep its credentials valid. Any of these would fix it:

  1. When the host refresh is unreachable, fall back to the remote host's own Claude Code login, if one exists.
  2. An option in the SSH connection dialog: "Use this host's Claude Code login" instead of forwarding the Desktop token.
  3. At minimum, a clear message. The UI says "Claude Code on your computer needs to sign in again", but the remote host is already signed in: what expired is the token forwarded by Desktop. The message should say that the Desktop app must be awake to refresh the token.

Error Messages/Logs

Last two entries of the session transcript on the remote host:

2026-10-01T03:36:04Z user       (message sent from claude.ai while the PC was asleep or the Desktop app was not running)
2026-10-01T03:36:35Z assistant  Failed to authenticate. API Error: 401 OAuth access token has expired. Re-authenticate to continue.

UI on claude.ai, in order (the UI is in Italian, translated here):

Claude Code on your computer needs to sign in again. Sign in there, then send your message again.
Can't reach your computer. It may be asleep or offline. This session will reconnect when it's available again.

The worker process stayed alive and idle the whole time (~/.claude/sessions/<pid>.json).

Steps to Reproduce

  1. In Claude Desktop (Windows), Code tab, start a session on an SSH host (Linux). Remote Control is on.
  2. Put the PC to sleep and wait until the forwarded access token expires (in our case the session last worked at 2026-09-30T16:21Z and failed at 2026-10-01T03:36Z).
  3. From claude.ai or the mobile app, send a message to the session.
  4. The worker answers with 401 OAuth access token has expired. The session works again only after the PC wakes up and Desktop refreshes the token.

Claude Code Version

ccd-cli 2.1.284 on the remote host (version pushed by Desktop). Claude Desktop 2.16120.0.

Platform

Anthropic API, Claude Max subscription

Operating System

Desktop: Windows. Remote host: Ubuntu 24.04.

Additional Information

Related issues, same root cause (the SSH session depends on the Desktop app for something the remote host could do on its own):

  • #94887: claude.ai connectors hang while the laptop sleeps, because they run inside the Desktop app.
  • #92613: Desktop SSH session gets a 401 while the CLI on the same host, same credentials file, works.
  • #95262: a remote-control session stays in 401 forever after a failed refresh.
  • #81354: the Windows Desktop app refreshes its OAuth token lazily.

View original on GitHub ↗