[Bug] Remote Control: stale environments cannot be deleted and ghost sessions cause permanent 404 errors
UPDATE: This is not a single stale session. After registering a brand-new environment, the 404 returned on the next launch with a DIFFERENT session ID (cse_<REDACTED_2> vs the original cse_<REDACTED_1>), on the same fresh environment. Sessions appear to be created and then not found at worker-attach time, seconds later. Abandoning the environment does not fix it — the new environment reproduces the failure and leaves an undeletable duplicate row in the picker.
Remote Control: a ghost session can permanently 404 an environment, and stale environments can't be removed or told apart
Preflight Checklist
- [x] I have searched existing issues (this extends #50884 with a case where the missing delete affordance is not merely cosmetic)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (2.1.208)
What's Wrong?
Two problems that compound each other: a stale session can permanently break an environment, and there is no way to remove the environment you're then forced to abandon.
1. A ghost session 404s on every launch
Every claude remote-control start printed:
Error: CCR v2 worker registration failed for session cse_<REDACTED>:
Request failed with status code 404
Same session ID each time, reproducible across restarts, on the latest build, with claude doctor clean and no ANTHROPIC_* variables set. The environment's server-side session list contained a session that no longer existed, so the bridge tried to attach a worker to it on every start and failed.
The session ID is not stored locally — grep -rl "cse_<id>" ~/.claude ~/.claude.json returned nothing. Only the environment pin is local:
~/.claude/projects/<mangled-project-path>/bridge-pointer.json
Workaround: move bridge-pointer.json aside, forcing registration of a fresh environment. This clears the 404 — but the only escape from a bad environment is to abandon it, which strands the old one in the picker forever. Which leads to:
2. Stale environments cannot be removed or told apart
The picker now shows two identical, dead rows:
Remote Control
<Folder> 0 of 32 <Hostname>
<Folder> 0 of 32 <Hostname>
- No delete affordance in the CLI, web, or mobile app.
- Confirmed server-side: the rows appear at
claude.ai/codein a browser, not just in Desktop. Signing out and relaunching does not clear them. Nothing local references them. - Environments cannot be renamed. The label is derived from folder name + hostname, so two environments registered from the same directory are visually indistinguishable. The only tell between live and dead is the capacity count.
Contributing factor: Claude Desktop Code sessions also register Remote Control environments (via Settings → Claude Code → Enable remote control by default). This made the source hard to trace — ps aux | grep "claude remote-control" returned nothing while the rows persisted, because the registering processes were Desktop Code sessions, not a remote-control server.
Steps to Reproduce
- Run
claude remote-controlin a project directory. Note the environment ID. - Get the environment into a state where a session in its list no longer exists server-side. (In my case this happened on its own; I don't have a deterministic trigger.)
- Observe the 404 on every subsequent launch. It survives restarts and
claude update. - Move
~/.claude/projects/<project>/bridge-pointer.jsonaside and relaunch. - The 404 is gone, but the picker now permanently shows two identical rows for the same folder — one live, one dead — with no way to remove either.
Expected Behavior
- Orphaned sessions are reaped server-side, so a dead session ID cannot permanently 404 an otherwise healthy environment.
- The CLI can drop a bad session without abandoning the whole environment.
- Remote Control environments can be deleted from the web, mobile, and CLI.
- Environments can be named, or the picker surfaces the working directory, so two entries from the same folder are distinguishable.
- Sessions deregister gracefully on shutdown so rows don't strand.
Impact
The current best workaround is to ignore the environment picker entirely and navigate by environment URL. For anyone using Remote Control regularly, the picker fills with dead, identically-named entries and stops being usable.
Environment
- Claude Code: 2.1.208 (native install)
- Platform: macOS, darwin-arm64
- Shell: zsh
- Also installed: Claude Desktop (Code tab), remote control on by default//
Confirming this on Claude Desktop 1.24012.9, macOS 26.6 (arm64), Max plan — still present, and with one new detail that I think matters for the "how do you tell live from dead" part.
The capacity counter is not live at all.
This issue and #78695 both note that the only tell between a live and a dead environment is the session count. That heuristic doesn't hold. In my case the picker shows:
Remote Control
Claude <host> 0 of 32
Claude <host> 2 of 32
I fully terminated Claude Desktop on the host machine and verified it was gone (pgrep -x Claude empty, no claude CLI installed on that machine at all). Both rows stayed, and the second one kept reading 2 of 32 — two sessions attributed to a host with no process running. So a stale environment can show a non-zero count, and a count of zero doesn't mean the environment is the dead one either. There is currently no reliable way to tell them apart.
Desktop-hosted equivalent of bridge-pointer.json
Your note that Desktop Code sessions register environments (and therefore ps aux | grep "claude remote-control" finds nothing) was exactly right, and cost me a while to work out independently. For the Desktop path the local pin lives at:
~/Library/Application Support/Claude/bridge-state.json
keyed by <orgId>:<accountUuid> — no device component, so there is a single environmentId per app installation and it is overwritten in place. Same failure shape as moving bridge-pointer.json aside: the previous environment is never deregistered, and once the id is overwritten nothing local references it, so the app can't release it on quit either. Grepping all Claude state on two machines for env_ returns only this one file, holding only the current id.
Also ruled out here, in case it saves anyone time
| Attempted | Result |
|---|---|
| Cmd+Q and relaunch | Both rows remain |
| Reboot the host machine | Both rows remain |
| Signing out of the account in Claude Desktop on the host | Both rows remain; bridge-state.json untouched, still enabled: true with the same environmentId |
| Settings → Claude Code → Enable remote control by default toggle | bridge-state.json byte-identical afterwards; the setting isn't persisted in the app's config.json either |
| Right-click the row in the picker | No context menu |
| claude.ai/code web picker | Same two rows; in the DOM they are bare menuitemradio elements — no delete control, no submenu, nothing revealed on hover |
One difference from #78695: environmentId stayed constant across several app restarts, so the Desktop path doesn't accumulate a new environment per launch. The orphan here appears to be a one-off leftover from an earlier reinstall or re-login, which I couldn't reproduce after the fact.
Happy to supply environment ids and account details privately.
Additional datapoint — a slightly different flavor of the same server-side dangling reference: in our case it is the worker itself that keeps retrying a ghost session at every startup.
Setup: claude remote-control running 24/7 under systemd (Ubuntu Server 26.04). At every service start over the past week and a half (9 starts, currently on CLI 2.1.223), the worker logs:
Error: CCR v2 worker registration failed for session cse_01Acw…: Request failed with status code 404
Always the same weeks-old session id. The environment itself re-registers fine and new sessions work, so this is harmless day-to-day — but the dangling reference survives CLI version updates, nothing in the CLI or the apps lists it, and so nothing can delete it.
Corroborates both halves of this issue: session records that go missing server-side while a client still holds a reference to them, and no cleanup path for the resulting ghost.
+1, hitting this too. Adding a clean repro in case it helps narrow the cause down — this one isn't from a directory-layout change, just plain restarts of the same server pointed at the same unchanged directory.
Setup: Windows 11, native claude.exe install, claude remote-control --spawn same-dir --capacity 4 launched by a Task Scheduler job (restarts the server on legitimate triggers — a local config fix, a network-outage self-heal check, etc. — so restarts happen periodically over the life of the setup, not just once).
Repro:
Start claude remote-control in a directory. Console prints an environment URL: https://claude.ai/code?environment=env_AAAAAAAA. Stop the process, start it again in the exact same directory (no path change, no casing change, nothing). Console prints a new ID: env_BBBBBBBB. Repeat over a few days of normal restarts → mobile app (Devices → [device]) now lists the same local folder as N separate entries, one per historical restart, with no way to tell which is the live one. Over three days of intermittent restarts I've got 4 entries for one folder now.
Ruled out on my end, in case it saves someone time:
Not a local .claude.json issue — that file only ever has one correct/trusted entry for the directory at any point in time. Not an app-cache issue — reinstalling the mobile app wouldn't touch this, since the entries reflect live backend state, not something cached client-side. No CLI escape hatch — claude remote-control --help has no list/revoke flag. So it looks like every server start unconditionally mints a new environment registration rather than reusing/updating an existing one for the same directory — the duplicate-entries-on-layout-change case in the OP is one trigger, but a plain restart with nothing changed is enough on its own.
+1 on the OP's proposed fixes — either reuse-by-directory on restart, or a delete/revoke action (CLI or UI) so this doesn't grow unbounded on any setup where the server restarts periodically by design.
Datapoint that corrects one claim in the OP and explains the workaround's mechanism: the ghost session ID is stored locally — the grep missed it because of a prefix mismatch.
The error prints the id as cse_…, but ~/.claude/projects/<project>/bridge-pointer.json stores the same id as "sessionId": "session_…" (identical suffix, different prefix). Grepping for the cse_-prefixed form returns nothing, which is presumably why the OP concluded the id wasn't local. On my machine:
claude rcstarted; 6s later:Error: CCR v2 worker registration failed for session cse_01Krb…: Request failed with status code 404bridge-pointer.jsoncontains{"sessionId":"session_01Krb…","environmentId":"env_01Fh…",…}— same id.- The pointer was re-written by the running process hours after startup, still holding the dead id — so the CLI itself re-persists the session that 404'd, making the retry loop locally self-perpetuating. That's why moving the file aside clears it.
This suggests a narrower workaround than abandoning the environment (which strands a picker row, per the second half of this issue): stop the server, delete only the sessionId key from bridge-pointer.json, keep environmentId, restart. I haven't tested this yet — my 404 is the harmless flavor (environment registers fine, new sessions work) and the server is in use — but if the pin drives re-registration, it should drop the ghost session without orphaning the environment.
Env: Claude Code 2.1.226 (native), macOS arm64 (Darwin 27), interactive claude rc in a terminal; occurrence is intermittent here rather than every start.
Same prefix mismatch here, on my server (headless Linux, claude remote-control under systemd — setup from my earlier comment).
The worker logs at every start:
Error: CCR v2 worker registration failed for session cse_01Acwizs…: Request failed with status code 404
17 times between Aug 2 and Aug 11, always the same id. ~/.claude/projects/<project>/bridge-pointer.json contains "sessionId": "session_01Acwizs…" — identical suffix, session_ prefix instead of cse_. So the id is stored locally here too, and a grep for the cse_ form finds nothing.
The rewrite part also matches. The current worker started 03:35 today; the pointer's mtime is 10:35 the same morning and its pid field is the current worker's pid. The process rewrote the file hours into its run and wrote the dead sessionId back.
One datapoint on origin: the first 404 was logged Aug 2 00:09:47, seconds after a kernel OOM killed a session child process on this machine (the incident I reported in #81343). The dangling id dates from that crash and has survived every nightly CLI update and reboot since.
Haven't tried deleting the pointer file — this worker is in production use.
Two corrections to my own earlier comments in this thread, and a discovery about where the ghost actually comes from.
Correction 1: my Aug 11 comment said the first 404 was logged Aug 2 00:09:47. That was a measurement artifact. My systemd unit gained an ANSI-stripping log filter in early August; error lines from before that are stored with escape codes and render as [136B blob data] in plain journalctl — invisible to grep. With journalctl --all two earlier occurrences appear, and the real series is:
- 26 occurrences on 26 consecutive service starts, Jul 31 08:58:13 through the most recent start (Aug 17 23:07) — one per start, landing 6–12 seconds after each start.
- Always the same id:
cse_01Acwizs…, never a different one. - It has survived every CLI update from 2.1.220 through 2.1.234 (current latest) and 6 reboots.
(Tip for anyone reproducing this on a service: if your unit logs raw terminal output, the error hides as [blob data] — count with journalctl --all.)
Correction 2: the ghost is not a crash orphan. My Aug 11 comment said "The dangling id dates from that crash" (the Aug 2 kernel OOM from my #81343 report). Also wrong — and the truth is stranger. With --all, the id appears exactly one more time in my journal, before the failures:
Jul 29 07:18:00 Session completed (1m 41s) cse_01Acwizs…
That is a session that was created around 07:16 on Jul 29 — within minutes of the environment id itself first appearing (07:16:12), so plausibly the environment's very first session — ran for 1m41s, and completed normally. No crash, no kill. Two days later the 404 series began, and the id has produced nothing but this error since. (So both of my earlier framings — "weeks-old" on Aug 6 and "dates from that crash" on Aug 11 — were wrong: the ghost is a cleanly-completed session from Jul 29.)
Where the series starts is sharp: on Jul 31, after a reboot and a ~6-minute credential-loss crash loop, a start at 08:54:04 on the then-installed CLI — a long-stale native install stuck on 2.1.197 with auto-updates off — connected with no registration error. At ~08:58 that install was updated in place to 2.1.220 (a stray npm-global duplicate installed that morning as a repair attempt was removed at the same time) and the service restarted: the first start on 2.1.220 logged the first 404 six seconds in, and every one of the 26 starts since has repeated it. Honest caveat: successful registration is silent, so I can't tell whether 2.1.197 was re-registering the id successfully or simply didn't exercise this registration path at all.
Two recent examples where the running version is not in doubt:
Aug 15 03:39:03 Successfully updated from 2.1.232 to version 2.1.233 (nightly updater)
Aug 15 03:39:03 systemd: Started claude-remote.service
Aug 15 03:39:10 Error: CCR v2 worker registration failed for session cse_01Acwizs…: Request failed with status code 404
Aug 17 23:06 manual `claude update` to 2.1.234
Aug 17 23:07:13 systemd: Started claude-remote.service
Aug 17 23:07:19 Error: CCR v2 worker registration failed for session cse_01Acwizs…: Request failed with status code 404
(For the second: the next morning's update check reports "up to date (2.1.234)" with the service untouched in between, so that worker ran 2.1.234.)
The local pointer still holds the dead id, and it keeps being written back carrying the live worker's pid:
~/.claude/projects/<project>/bridge-pointer.json
"sessionId": "session_01Acwizs…" ← same suffix as the error, session_ prefix
"environmentId": "env_01Gf2…"
"pid": <pid of the currently running worker>
- On a fresh start: the restart of Aug 17 began at 23:07:12, the new worker was up at 23:07:13, and its pid was in the pointer at 23:07:15 — about two seconds into its life — with the same dead session id; the registration that failed at 23:07:19 failed on exactly that id. (File mtime recorded live at the time; since overwritten by the next rewrite.)
- Mid-run: rewrites observed 39 hours into one worker's life (Aug 17 22:24) and 9 hours into the current one (Aug 18 08:07).
So it is not a stale file nobody touches: the dead id is re-persisted at worker startup and again during the run.
This looks like the same failure leodurandfr isolated in #86045 (registration 404 on every re-launch of a previously-registered environment, clean on a fresh one). My series fits that pattern — every registration attempt on this long-registered environment has failed since the boundary — and the pointer behaviour above may be the connecting piece: a fresh directory has no pointer, nothing stale to re-submit. And notably, the session my pointer clings to ended cleanly — matching his stops (Ctrl+C, closed terminals) rather than a crash. (Inference from timing and the matching suffix, not a packet capture.) I'm keeping the ghost-cannot-be-listed-or-deleted side here since that is this issue's subject.
To be explicit about what I am not claiming: 2.1.232 shipped "resuming a conversation whose session was deleted from claude.ai or the app now starts a replacement instead of failing with a message about your login (regressed in v2.1.227)", and 2.1.234 fixed a "misleading HTTP 404" on signing in to a different account. Both are different code paths from worker registration, so I have no basis to say either should have covered this. I am only reporting that the ghost is unaffected by both.
Still haven't deleted the pointer file — this worker is in production use. Happy to delete it and report what happens if that would be a useful datapoint.
Another data point for the duplicate-rows part of this. I don't see the 404, only the undeletable duplicates.
Claude Code 2.1.263, Linux. One claude remote-control --no-create-session-in-dir server per project directory, run by a systemd user service. I restarted the service with systemctl restart, so the servers got a normal SIGTERM shutdown, not a crash.
Result:
- The "Choose directory" picker in the iOS app now lists each directory twice.
- I sent a message in both duplicated entries. One responded; the other stayed on "Thinking…" indefinitely. So the extra rows are dead and indistinguishable from the live ones.
- The environment ID in the startup banner changed after the restart, so a new environment was registered instead of the old one being reused.
- On restart, each server first failed with
Registration: Failed with status 409: This folder is already served by a terminal claude remote-control on this device. A retry about a minute later succeeded.
So a normal service restart leaves a ghost row per project, with no way to delete it. Graceful deregistration on SIGTERM, server-side expiry, or a delete action would all fix it.
The 404 series earlier in this thread is mine. I wrote the duplicate-rows mechanism up in #86045 rather than here: whether a restart mints a new environment or reuses the old one is decided by the local bridge-pointer.json, and keeping environmentId while clearing sessionId is what stopped new rows appearing on this machine.
Two things have changed since that comment. The run is longer: 15 service starts between 2026-09-04 08:13 and today, including a machine reboot on 2026-09-10, all on the same environment id, no new rows. And I have never logged the 409 "already served by a terminal claude remote-control on this device" that you get on every restart; grepping this journal back to 2026-07-26 returns none. I run a single server on the home directory without --no-create-session-in-dir, so your per-directory case is one I can't reproduce.
If your pointers survive the restart, worth checking what pid and procStart hold when the new server starts: a pid that still resolves to a live process is what sends the CLI down the register-a-fresh-environment path.
The rows already in the picker stay either way, and there is still no delete action.
Edited on 2026-09-23: the count read 14; one start happened while journald was restarting and my count missed it.
Workaround that removed a stale claude remote-control environment from the picker for me (Claude Code 2.1.309, macOS). It works when the stale entry came from a CLI run in a folder whose bridge-pointer.json still holds that environment's ID.
Why the entry stays: on SIGTERM or Ctrl+C, the CLI keeps the environment so it can resume later. It logs Skipping archive+deregister to allow resume and only marks it offline. It deregisters instead only when it could not write bridge-pointer.json during startup.
Steps:
- Find the pointer for the folder the stale entry came from:
~/.claude/projects/<sanitized-path>/bridge-pointer.json. ItsenvironmentIdshould match the stale entry. - Make an empty folder inside an already trusted folder, so there's no trust prompt (for example
~/Projects/.rc-cleanup). Copy the pointer into that folder's project directory,~/.claude/projects/<sanitized-new-path>/. This also works when the original folder is now served by the desktop app, which otherwise refuses with "This folder is already served by the Claude app". - Lock the copied pointer so the CLI can't rewrite it:
chflags uchg bridge-pointer.jsonon macOS. On Linux,chattr +ishould do the same; I didn't test it. - In the new folder, run
claude remote-control --debug-file rc.log, without--no-create-session-in-dir(with that flag the pointer is never read). The log should showFound prior environment env_… in pointer; requesting reuseand then[bridge:pointer] write failed: EPERM. - Stop it after a few seconds with Ctrl+C or SIGTERM. The log should show
Environment deregistered, bridge offline, and the stale entry disappears from the picker on web and mobile. - Clean up:
chflags nouchg, then delete the temporary folder, its project directory, and the original stalebridge-pointer.json.
A first-class "remove environment" action would still be much better.
Same on macOS, 2.1.322, claude remote-control run under launchd. Restarts over Nov 10 to 12 registered 4 separate environments, all shown as "Documents ·