[BUG] Desktop app crashes on hook_callback control request — "Failed to load session" on any query triggering tool use
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment:
Claude Code desktop app: v1.1.4173 (confirmed latest via Check for Updates)
Claude Code CLI: v2.1.51
macOS 26.3 (Build 25D125, Darwin 25.3.0)
Apple M4, 16 GB RAM
Reproduction steps:
Open any project with a CLAUDE.md file
Open a new session window
Type any prompt that will cause the model to use a tool (e.g., Read Artifacts/some-file.txt and summarize it)
Session immediately fails with "Failed to load session"
Prompts that don't trigger tool use (e.g., hello) succeed. If you send hello first and then send a file-read prompt as the second message, the second message fails with the same error.
What happens (from ~/Library/Logs/Claude/main.log):
The CLI starts, maps the session, and processes the query. When the query triggers tool use, the CLI sends a hook_callback control request to the desktop app:
Session local_XXXX query error: CLI output was not valid JSON.
This may indicate an error during startup.
Output: {"type":"control_request","request_id":"...","request":{"subtype":"hook_callback","callback_id":"hook_2","input":{"session_id":"...",...
The desktop app classifies this as error_category: 'json_parse_error' and kills the session.
Session-level evidence (from .jsonl):
Captured a two-query session to isolate the bug:
Query 1 (hello): CLI starts → model calls Read tool (for auto-memory MEMORY.md) → tool executes successfully → model responds → 2 Stop hooks fire via callback → query completes normally
Query 2 (Read Artifacts/file.txt and summarize it): CLI sends query to API → model begins streaming thinking tokens (8 tokens received) → hook_callback for hook_2 fires → desktop app fails to parse it → session killed
The hook fires at query-processing time, not at tool-use time. The model hadn't even generated a tool call yet when the session was killed.
Scale: 87 hook_callback/hook_2 crash events logged in a single day of use. 100% reproduction rate on any new session with tool-triggering prompts.
Workaround found: One session that was already running when this bug manifested continues to work normally (all tool types). No new sessions can survive a tool-triggering query.
Additional context:
There is also a persistent background error (may be related):
[LocalSessionManager] Failed to check git status: Failed to spawn git (via disclaimer):
/Applications/Claude.app/Contents/Helpers/disclaimer exited with code 128:
fatal: Unable to read current working directory: Operation not permitted
Log files available:
~/Library/Logs/Claude/main.log — all 87 crash events with full metadata
~/.claude/projects/.../3e2d3812-0e56-4b86-9a7a-8df54a301ecd.jsonl — the two-query session showing Query 1 succeeding and Query 2 dying
What Should Happen?
Claude Code should be able to access files in the file path and use other tools.
Error Messages/Logs
Failed to Load Sessions
Steps to Reproduce
Reproduction steps:
Open any project with a CLAUDE.md file
Open a new session window
Type any prompt that will cause the model to use a tool (e.g., Read Artifacts/some-file.txt and summarize it)
Session immediately fails with "Failed to load session"
Prompts that don't trigger tool use (e.g., hello) succeed. If you send hello first and then send a file-read prompt as the second message, the second message fails with the same error.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code desktop app: v1.1.4173 ; Claude Code CLI: v2.1.51
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
I spent multiple hours and many tokens trying to solve this issue via Sonnet and then Opus and this is the final result of my efforts.
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Thanks — I reviewed the suggested issues and this does not appear to be a duplicate.
Summary of this bug
Desktop app v1.1.4173 + CLI v2.1.51 on macOS 26.3:
Any prompt that triggers tool use causes the desktop app to classify the arriving hook_callback control request as a json_parse_error, immediately killing the session with:
“Failed to load session”
This reproduces 100% of the time in new sessions. I observed 87 crash events in one day. Continuing sessions remain stable; only newly created sessions crash when tool use is triggered.
Relevant artifacts are attached:
~/Library/Logs/Claude/main.log (crash events included)
.jsonl file showing a two-query session (Query 1 succeeds, Query 2 triggers crash)
Why this is different from the suggested issues
#23519
That issue concerns the CLI producing invalid JSON after a Bedrock /count-tokens 403 error.
My issue does not involve Bedrock 403 responses or /count-tokens. The failure occurs when the desktop app attempts to parse a hook_callback control request. The trigger and error context differ.
#24794
That issue involves the async hook stdout parser failing on multi-line JSON and dropping additionalContext.
My issue is not related to multi-line stdout formatting. The session fails when receiving a control_request object (see attached .jsonl), before any model-generated tool output is processed.
#27472
That issue is caused by U+2028 (LINE SEPARATOR) characters in Bash tool output.
My issue reproduces with any tool-triggering prompt and is not dependent on Unicode separator characters in tool output. The failure is specifically a JSON parse error of the hook_callback control request.
Minimal Reproduction
Open any project containing CLAUDE.md.
Start a new desktop session.
Send a prompt that triggers tool use (e.g., “Read Artifacts/some-file.txt and summarize.”).
Session immediately fails with “Failed to load session.”
Prompts that do not trigger tool use succeed. If the first message avoids tool use and the second triggers it, the second message crashes the session.
Impact
100% reproducible in new sessions.
Blocks tool usage from the desktop app.
Logged 87 crash events in one day.
Please let me know if additional logs or a reduced repro artifact would help triage. I’d appreciate keeping this open until confirmed duplicate or root cause is identified.
Thanks.
I have solved the problem:
Bug: Claude Code desktop app crashes with "Failed to Load Session" when the Read tool attempts to read any file containing U+2028 (LINE SEPARATOR) or U+2029 (PARAGRAPH SEPARATOR) characters.
Root cause: These characters are treated as line terminators in JavaScript/V8, which silently breaks JSON serialization in Electron's IPC layer when file content is passed between the CLI process and the desktop app.
How to reproduce: Convert any .docx file to .txt (common with textutil on macOS or similar tools), then ask Claude Code desktop to read the resulting file. The session will crash with no useful diagnostic message.
Why it's particularly bad: The error message ("Failed to Load Session") gives zero indication that file content is the cause. There's no fallback, no helpful error, nothing pointing to the file or the character. A user could spend hours — as you did — ruling out permissions, cache corruption, OAuth tokens, filenames, and a dozen other things before finding it.
The fix Anthropic should implement: Either properly escape U+2028/U+2029 in the IPC serialization layer, or catch the failure and surface a meaningful error message pointing to the file.
Additional reproduction path: context compaction → dead session hook loop.
When a long session hits context limits and gets compacted/continued into a new conversation, the old session ID becomes a dead reference. On next app launch, the CLI tries to fire a
hook_callbackfor the old session, producing the same crash:This repeats on every relaunch — the app is stuck in a loop retrying the same hook against a dead session. The only escape is starting a completely fresh session.
Environment: macOS 26.3 (Build 25D125), Claude Code v2.1.63, Apple M2 Max, multiple MCP servers connected.
(Closing #30117 as duplicate — same root cause.)
Thanks for reporting the issue. The fix will go out with the next release.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.