[BUG] Persistent API Error After Teleporting Session
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
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
- Start a Claude Code session
- Used
claude --teleport session_011CUpE6ZSg5RQbETyMDpZha - Attempted to run any command
- 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_
15 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I am facing the same issue.
Claude Code Version
2.0.34 (Claude Code)Operating System
macOSTerminal/Shell
ghosttyError
Same issue
Same issue, also on MacOS using Ghostty
Session was teleported from a Claude Code Web session
Hello, can someone look into this please? I have the same issue every time continuing session by using teleport from Claude Code web. Thanks
This issue is still present on v2.0.37.
I have never once gotten
teleportto work. Every time I get the API 400 error.This issue still persists on v2.0.53.
This issue still persists on v2.0.55.
This issue still persists on v2.0.69
This issue still persists on v2.0.72
My current workaround is to
/exportthe conversation to clipboard, then paste it in a new session.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.
Diagnostic & Repair Information for Orphaned tool_result Errors
For those encountering this after
--teleport, the root issue is that the session JSONL containstool_resultblocks whose correspondingtool_useblocks 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:
This will show both the
tool_useand anytool_resultentries. If you see atool_resultbut no correspondingtool_use(or thetool_useis malformed), that's your orphan.Common Patterns
Scenario 1: Teleport Corruption
When teleporting from web → CLI, tool calls sometimes don't transfer correctly:
tool_useentry is missing or incompletetool_resultentry transferred finetool_resultScenario 2: Interrupted Tool Calls
If Claude Code crashes or is interrupted during a tool execution:
tool_usemight be partially written or have invalid JSONtool_resultmight remainManual 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 orphanedtool_result: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 updateparentIdreferences in subsequent lines to maintain the conversation chain.Alternative: Start Fresh with Export
As @madeyexz mentioned,
/exportto 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:
/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!
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
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.