Summary
Interrupting an agent mid-tool (Ctrl+C) ends the session with a tool_use
block that has no matching tool_result. Exporting such a session
(txcript continue <id> --with claude) writes the bare tool_use into the
Claude Code session, and the Anthropic API rejects the whole conversation
on resume with HTTP 400 — each tool_use must have its tool_result in
the next message.
What happened?
A Common transcript ending in an unanswered ToolUse (e.g. stop_reason
aborted) exports to Claude Code native with the tool_use and no
tool_result after it. The resumed session fails to load with the API's
pairing error.
Expected
Export appends one aborted error result per unanswered call, so the resumed
session loads. This matches the API 400s reported in
anthropics/claude-code#8004, #8210, #473 (same cause: tool_use without
tool_result immediately after).
How to reproduce
// Assistant turn ending in an unanswered ToolUse (e.g. stop_reason Aborted).
let native = claude_code::ClaudeCode::from_common(&common).unwrap();
// Exported body contains `tool_use` with no following `tool_result`.
Verified at the export level: unpatched main emits the bare tool_use;
the fix's export satisfies the pairing rule. No live-resume check as i am not currently subscribed to claude pro. Requires manual check if possible!
Versions
- txcript: 0.14.4
- Operating system: Windows (applies on all platforms)
Summary
Interrupting an agent mid-tool (Ctrl+C) ends the session with a
tool_useblock that has no matching
tool_result. Exporting such a session(
txcript continue <id> --with claude) writes the baretool_useinto theClaude Code session, and the Anthropic API rejects the whole conversation
on resume with HTTP 400 — each
tool_usemust have itstool_resultinthe next message.
What happened?
A Common transcript ending in an unanswered
ToolUse(e.g.stop_reasonaborted) exports to Claude Code native with the
tool_useand notool_resultafter it. The resumed session fails to load with the API'spairing error.
Expected
Export appends one aborted error result per unanswered call, so the resumed
session loads. This matches the API 400s reported in
anthropics/claude-code#8004, #8210, #473 (same cause:
tool_usewithouttool_resultimmediately after).How to reproduce
Verified at the export level: unpatched main emits the bare tool_use;
the fix's export satisfies the pairing rule. No live-resume check as i am not currently subscribed to claude pro. Requires manual check if possible!
Versions