Skip to content

Interrupted sessions resume-broken on Claude Code: dangling tool_use with no tool_result #68

Description

@Drix10

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions