[BUG] Remote Control disconnects an unrelated session when a different CLAUDE_CONFIG_DIR re-authenticates
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Remote Control disconnects an already-running session the moment a completely different, unrelated CLAUDE_CONFIG_DIR on the same machine re-authenticates — even though that other session's own credentials, directory, and account were never touched.
What Should Happen?
Signing in to a different account under one CLAUDE_CONFIG_DIR should not affect a Remote Control connection for a session running under a different CLAUDE_CONFIG_DIR on the same machine. This is the same isolation the docs confirm already applies to the underlying .credentials.json file itself (it lives inside whichever CLAUDE_CONFIG_DIR is set).
Error Messages/Logs
Remote Control disconnected — signed-in claude.ai account or organization
changed on this machine — run /remote-control to start a session for the
current account, or /login to switch back, then /remote-control
Steps to Reproduce
- Set up two projects on one machine, each with its own distinct
CLAUDE_CONFIG_DIR, each signed into a different Claude account (e.g.CLAUDE_CONFIG_DIR=~/.claude-project-aandCLAUDE_CONFIG_DIR=~/.claude-project-b). - Start a
claudesession in project A (VS Code integrated terminal) and leave it running. - In a separate VS Code window/terminal, start a session with
CLAUDE_CONFIG_DIRpointed at project B's directory, and run/loginthere to sign in to a different account than the one already logged in. - Project A's already-running session — a completely separate
CLAUDE_CONFIG_DIR, never touched by step 3 — immediately prints the Remote Control disconnect message above.
Note: the bug only shows up with genuinely separate CLAUDE_CONFIG_DIRs that are each meant to be isolated; it does not require anything unusual about either project's contents.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Claude Code Version
2.1.240 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
I haven't found an existing issue for this exact interaction — the closest related reports are a cluster of open issues where CLAUDE_CONFIG_DIR isolates the credentials file correctly but other account-identity-adjacent state does not consistently follow it: #87447 (a session's CLAUDE_CONFIG_DIR names a different account than the one it actually authenticates/bills under), #84561 (status bar shows the default account instead of the CLAUDE_CONFIG_DIR account), #81278 (CLAUDE_CONFIG_DIR not honored for credential storage on macOS without also setting the undocumented CLAUDE_SECURESTORAGE_CONFIG_DIR), #79223 (docs request for that same undocumented variable). This may be the same underlying gap surfacing in Remote Control specifically, or a separate instance of it — filing in case it's useful signal either way.
Also structurally similar: #83759, where a credential rotation on one machine cascaded into a Remote-Control-visible disconnect for a session on a completely different machine — suggesting the server side may treat any credential-rotation signal as informative for every session tied to the account/org, rather than scoping it to the session whose own credential actually rotated.
disableRemoteControl in settings.json is a workaround for suppressing this, but it turns Remote Control off entirely rather than fixing the cross-CLAUDE_CONFIG_DIR scoping.