claude --resume crashes on killed sessions + Ctrl+C unresponsive during tool execution
Bug: claude --resume crashes with "No messages returned" on incomplete sessions
Environment
- Claude Code version: 2.1.12
- OS: Fedora 43 (Linux 6.18.5)
- Shell: zsh
Description
When a Claude Code session is killed during tool execution, the .jsonl session file is left in an incomplete state. Attempting to resume this session with claude --resume <session-id> fails with:
This error originated either by throwing inside of an async function without a catch block,
or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: No messages returned
at cAB (/$bunfs/root/claude:5329:78)
at processTicksAndRejections (native:7:39)
Steps to Reproduce
- Start a Claude Code session
- Ask Claude to execute a long-running or slow command (triggers
tool_use) - Session appears frozen, Ctrl+C doesn't respond
- User runs
killall claudeorkillall -9 claudefrom another terminal - Try to resume:
claude --resume <session-id> - Observe the crash
Root Cause Analysis
The session .jsonl file ends with:
{"type": "user", "message": {...}} // User's question
{"type": "assistant", "message": {"content": [{"type": "thinking", ...}]}}
{"type": "assistant", "message": {"content": [{"type": "tool_use", "name": "Bash", ...}]}}
// Missing: tool_result entry
The file is syntactically valid JSON (each line parses correctly), but the conversation is in an inconsistent state: a tool_use was issued but no tool_result was recorded.
Expected Behavior
Claude Code should either:
- Gracefully recover: Detect incomplete tool calls and either retry or skip them
- Prompt the user: "Last session ended during tool execution. Resume anyway? (last exchange will be lost)"
- Truncate automatically: Remove trailing incomplete messages and resume from the last valid state
Current Workaround
Rename or delete the problematic session file:
mv ~/.claude/projects/<path>/<session-id>.jsonl ~/.claude/projects/<path>/<session-id>.jsonl.bak
The session data is still readable with jq for manual extraction, but cannot be resumed.
Additional Context
- Session file size: ~1 MB (229 lines, 170 messages before the incomplete exchange)
- The crash occurred during execution of:
/usr/bin/grep -r "yazi" ~/.claude/projects/ - Manually removing the last 3 lines (incomplete exchange) did not fix the issue, suggesting the loader has additional validation that fails
Related Issue: Ctrl+C not responding
Before resorting to killall, the user tried Ctrl+C multiple times but the session did not respond. This suggests:
- Signal handlers may not be properly set up during tool execution
- Or the Bash subprocess blocks SIGINT propagation
This forces users to use kill/killall from another terminal, which is more disruptive and leaves no chance for graceful cleanup.
Suggested Fix
In the session loader, wrap message parsing in a try-catch and either:
- Skip malformed/incomplete trailing messages
- Or provide a
--resume --forceflag to attempt recovery
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗