[BUG] Persistent API Error After Teleporting Session

Status Closed — not planned
Maintainer reply None cached
Activity 15 comments · opened Nov 5, 2025 · closed Feb 28, 2026

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?

After using claude --teleport session_011CUpE6ZSg5RQbETyMDpZha, every subsequent command results in a 400 API error about malformed tool_result blocks.

What Should Happen?

Teleporting should transfer the session cleanly without corrupting conversation state.

Actual Behavior:
Session state corruption that persists even after reinstalling Claude Code.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.48.content.0: unexpected tool_use_id found in tool_result blocks: toolu_01XmC5ysqAiDPKb5kABUiSCi. Each tool_result block must have a corresponding tool_use block in the previous message."}}

Steps to Reproduce

  1. Start a Claude Code session
  2. Used claude --teleport session_011CUpE6ZSg5RQbETyMDpZha
  3. Attempted to run any command
  4. Received 400 error on every message

Troubleshooting Attempted:

  • ✅ Exited and restarted Claude Code
  • ✅ Killed all Claude processes
  • ✅ Uninstalled and reinstalled Claude Code
  • ✅ Tried in different directories
  • ❌ Error persists

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.33 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

15 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11017
  2. https://github.com/anthropics/claude-code/issues/11026
  3. https://github.com/anthropics/claude-code/issues/8484

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

kenryu42 · 9 months ago

I am facing the same issue.

Claude Code Version
2.0.34 (Claude Code)

Operating System
macOS

Terminal/Shell
ghostty

Error

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.50.content.0: unexpected
    `tool_use_id` found in `tool_result` blocks: toolu_019LH462QgZAC98M7ibbQJ8H. Each `tool_result` block must have a corresponding
     `tool_use` block in the previous message."},"request_id":"req_011CUr7Tku1wHmUS2JcBrcup"}
thedaviddias · 9 months ago

Same issue

leefowlercu · 9 months ago

Same issue, also on MacOS using Ghostty

Session was teleported from a Claude Code Web session

ngannguyen-nvn · 9 months ago

Hello, can someone look into this please? I have the same issue every time continuing session by using teleport from Claude Code web. Thanks

adamrothman · 9 months ago

This issue is still present on v2.0.37.

smartwatermelon · 9 months ago

I have never once gotten teleport to work. Every time I get the API 400 error.

fakade2 · 9 months ago

This issue still persists on v2.0.53.

waterbang · 9 months ago

This issue still persists on v2.0.55.

weidwonder · 8 months ago

This issue still persists on v2.0.69

madeyexz · 8 months ago

This issue still persists on v2.0.72

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.24.content.3: unexpected `tool_use_id` found in `tool_result` blocks: toolu_01LLjDFcWxGyYvTh5PchmaNu. Each `tool_result` block must have a corresponding `tool_use` block in the previous message."},"request_id":"req_011CWJ2roFn4MhGgseytCTx2"}

My current workaround is to /export the conversation to clipboard, then paste it in a new session.

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

n8kako · 7 months ago

Diagnostic & Repair Information for Orphaned tool_result Errors

For those encountering this after --teleport, the root issue is that the session JSONL contains tool_result blocks whose corresponding tool_use blocks are missing or malformed.

Identifying the Problem in Session Files

Claude Code stores sessions in ~/.claude/projects/-workspace/*.jsonl. Each line is a JSON entry.

To find orphaned tool_results:

# Replace with your session file
SESSION_FILE="~/.claude/projects/-workspace/YOUR_SESSION_ID.jsonl"

# Look for the tool_use_id from your error message
grep "toolu_YOUR_ID_HERE" "$SESSION_FILE"

This will show both the tool_use and any tool_result entries. If you see a tool_result but no corresponding tool_use (or the tool_use is malformed), that's your orphan.

Common Patterns

Scenario 1: Teleport Corruption
When teleporting from web → CLI, tool calls sometimes don't transfer correctly:

  • The tool_use entry is missing or incomplete
  • But the tool_result entry transferred fine
  • Result: orphaned tool_result

Scenario 2: Interrupted Tool Calls
If Claude Code crashes or is interrupted during a tool execution:

  • The tool_use might be partially written or have invalid JSON
  • A synthetic or empty tool_result might remain
  • Session becomes permanently broken

Manual Repair Approach

⚠️ Backup first: cp "$SESSION_FILE" "$SESSION_FILE.backup"

The safest repair is to remove both the problematic tool_use (if present) and its orphaned tool_result:

  1. Open the session JSONL in a text editor
  2. Find lines containing the tool_use_id from the error
  3. Remove those lines entirely
  4. Save the file
  5. Restart Claude Code

Important: Each line in the JSONL may have a "parentId" field that references the previous entry's "id". If you remove entries, you may need to update parentId references in subsequent lines to maintain the conversation chain.

Alternative: Start Fresh with Export

As @madeyexz mentioned, /export to clipboard then paste into a new session is often cleaner than manual repair, especially if the session has multiple corruption points.

Prevention

Until this is fixed in Claude Code:

  • Avoid teleporting sessions that have many tool calls
  • If you must teleport, do it early in the conversation before heavy tool use
  • Consider /export + new session instead of teleport for complex projects

---

Note: This is a workaround. The underlying issue needs to be fixed in Claude Code's teleport logic to properly validate and transfer tool_use/tool_result pairs.

Hope this helps others hit by this issue!

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 5 months ago

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.