claude-code - 💡(How to fix) Fix [BUG] Desktop app passes invalid --session-id ("local_" prefix) to bundled binary — all new Code-mode sessions crash with exit code 1 (regression since May 9 app.asar update)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

After the Claude Desktop app.asar update on May 9, 2026, every new Code-mode session crashes immediately with Claude Code process exited with code 1. Sessions created before the update continue to work. The root cause is a regression in the CCD code: when spawning a new session the desktop passes --session-id "local_<uuid>" (including the local_ prefix) to the bundled binary. The binary requires a plain UUID and rejects the prefixed value, writing "Error: Invalid session ID. Must be a valid UUID." to stderr and exiting with code 1. No output reaches stdout, so hadFirstResponse is always false and the session never gets a cliSessionId assigned, making every retry hit the same bug.

Error Message

Error: Invalid session ID. Must be a valid UUID. (→ stderr only) exit code 1

Root Cause

After the Claude Desktop app.asar update on May 9, 2026, every new Code-mode session crashes immediately with Claude Code process exited with code 1. Sessions created before the update continue to work. The root cause is a regression in the CCD code: when spawning a new session the desktop passes --session-id "local_<uuid>" (including the local_ prefix) to the bundled binary. The binary requires a plain UUID and rejects the prefixed value, writing "Error: Invalid session ID. Must be a valid UUID." to stderr and exiting with code 1. No output reaches stdout, so hadFirstResponse is always false and the session never gets a cliSessionId assigned, making every retry hit the same bug.

Fix Action

Workaround

Manually inject cliSessionId into each failing session config (the UUID part of sessionId, without the local_ prefix). This puts the desktop on the code path that uses the valid UUID:

python3 << 'PATCH'
import json, os, glob
sessions_dir = os.path.expanduser(
    "~/Library/Application Support/Claude/claude-code-sessions"
)
for path in glob.glob(f"{sessions_dir}/**/*.json", recursive=True):
    d = json.load(open(path))
    if not d.get("cliSessionId") and d.get("sessionId","").startswith("local_"):
        d["cliSessionId"] = d["sessionId"].replace("local_", "", 1)
        json.dump(d, open(path, "w"), separators=(",", ":"))
        print("Patched:", os.path.basename(path))
PATCH

Then restart Claude Desktop. Sessions that previously crashed should now open correctly.

Code Example

claude --session-id "local_e0ebc081-0224-427c-a476-033eb7e300a4" [other flags...]

---

Error: Invalid session ID. Must be a valid UUID.   (→ stderr only)
exit code 1

---

# Reproduces the exact crash (exit 1, no stdout output):
"/path/to/bundled/claude" \
  --output-format=stream-json \
  --input-format=stream-json \
  --session-id "local_e0ebc081-0224-427c-a476-033eb7e300a4"
# → "Error: Invalid session ID. Must be a valid UUID." on stderr
# → exit code 1

# Contrast — valid UUID works:
"/path/to/bundled/claude" \
  --output-format=stream-json \
  --input-format=stream-json \
  --session-id "e0ebc081-0224-427c-a476-033eb7e300a4"
# → proper stream-json init message, exit code 0

---

python3 << 'PATCH'
import json, os, glob
sessions_dir = os.path.expanduser(
    "~/Library/Application Support/Claude/claude-code-sessions"
)
for path in glob.glob(f"{sessions_dir}/**/*.json", recursive=True):
    d = json.load(open(path))
    if not d.get("cliSessionId") and d.get("sessionId","").startswith("local_"):
        d["cliSessionId"] = d["sessionId"].replace("local_", "", 1)
        json.dump(d, open(path, "w"), separators=(",", ":"))
        print("Patched:", os.path.basename(path))
PATCH
RAW_BUFFERClick to expand / collapse

Summary

After the Claude Desktop app.asar update on May 9, 2026, every new Code-mode session crashes immediately with Claude Code process exited with code 1. Sessions created before the update continue to work. The root cause is a regression in the CCD code: when spawning a new session the desktop passes --session-id "local_<uuid>" (including the local_ prefix) to the bundled binary. The binary requires a plain UUID and rejects the prefixed value, writing "Error: Invalid session ID. Must be a valid UUID." to stderr and exiting with code 1. No output reaches stdout, so hadFirstResponse is always false and the session never gets a cliSessionId assigned, making every retry hit the same bug.

Environment

  • macOS: Darwin 25.4.0 (Apple Silicon)
  • Claude Desktop: 1.6608.2 (app.asar modified May 9 00:13)
  • Bundled Claude Code binary: 2.1.128 (stored in ~/Library/Application Support/Claude/claude-code/2.1.128/)
  • CLI Claude Code: 2.1.140 (works fine; not affected)

Reproduction

  1. Open Claude Desktop → Code mode
  2. Start any new session (project dir or home dir)
  3. Send a message
  4. Session instantly crashes — Claude Code process exited with code 1, hadFirstResponse=false, cycle time 0s

Not reproducible via CLI — the binary works normally when invoked from the terminal.

Root cause

The exact failure

The desktop app stores sessions under ~/Library/Application Support/Claude/claude-code-sessions/<user-id>/<org-id>/<local_session_id>.json. A new session config has no cliSessionId field yet.

When the CCD code spawns the binary for a session without a prior cliSessionId, it passes:

claude --session-id "local_e0ebc081-0224-427c-a476-033eb7e300a4" [other flags...]

The local_ prefix makes this an invalid UUID. The binary exits:

Error: Invalid session ID. Must be a valid UUID.   (→ stderr only)
exit code 1

Because nothing is written to stdout, hadFirstResponse stays false. The desktop never receives a session UUID from the binary, so cliSessionId is never stored — and every subsequent retry hits the same code path.

Direct reproduction of the crash

# Reproduces the exact crash (exit 1, no stdout output):
"/path/to/bundled/claude" \
  --output-format=stream-json \
  --input-format=stream-json \
  --session-id "local_e0ebc081-0224-427c-a476-033eb7e300a4"
# → "Error: Invalid session ID. Must be a valid UUID." on stderr
# → exit code 1

# Contrast — valid UUID works:
"/path/to/bundled/claude" \
  --output-format=stream-json \
  --input-format=stream-json \
  --session-id "e0ebc081-0224-427c-a476-033eb7e300a4"
# → proper stream-json init message, exit code 0

Session log evidence

~/Library/Logs/Claude/main.log shows the correlation is 100%:

Session createdHas cliSessionId?Crashes?
May 4–8 (before update)✅ Yes❌ No
May 9–12 (after update)❌ No✅ Yes

Every session created on or after May 9 at 00:13 (the app.asar modification timestamp) lacks cliSessionId and crashes with exit code 1. Every session created before that works.

The regression

Pre-update behaviour: CCD strips the local_ prefix before passing to --session-id (session UUID only → valid). Post-update behaviour: CCD passes the full desktop session ID including local_ prefix → binary rejects → exit code 1.

Workaround

Manually inject cliSessionId into each failing session config (the UUID part of sessionId, without the local_ prefix). This puts the desktop on the code path that uses the valid UUID:

python3 << 'PATCH'
import json, os, glob
sessions_dir = os.path.expanduser(
    "~/Library/Application Support/Claude/claude-code-sessions"
)
for path in glob.glob(f"{sessions_dir}/**/*.json", recursive=True):
    d = json.load(open(path))
    if not d.get("cliSessionId") and d.get("sessionId","").startswith("local_"):
        d["cliSessionId"] = d["sessionId"].replace("local_", "", 1)
        json.dump(d, open(path, "w"), separators=(",", ":"))
        print("Patched:", os.path.basename(path))
PATCH

Then restart Claude Desktop. Sessions that previously crashed should now open correctly.

Expected behaviour

The desktop app should pass --session-id "<uuid>" (without the local_ prefix) so the binary can accept it, or omit --session-id entirely for brand-new sessions.

Impact

This affects all Code-mode sessions created since the May 9 app.asar update. Users with no pre-update sessions cannot use Code mode at all from the desktop app. The CLI is completely unaffected.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Desktop app passes invalid --session-id ("local_" prefix) to bundled binary — all new Code-mode sessions crash with exit code 1 (regression since May 9 app.asar update)