Claude Code 400 error: tool_use ids found without tool_result blocks on Windows, how to recover
On Windows with Claude Code 2.0.8 (Windows Terminal), the session fails with a 400 invalid_request_error saying tool_use ids were found without tool_result blocks immediately after, and suggests running /rewind. How can this be recovered, and is there a workaround?
Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/9002
4 answers
Status: the issue was closed as COMPLETED and marked as a likely duplicate of other reports; the thread contains no maintainer fix or release note tied to it.
What users reported as working or partly working:
- Run /rewind to roll the conversation back to before the broken tool call, then continue. One commenter on Windows with the VS Code extension said they had to use /rewind before using tools again, because retrying on the last conversation kept producing the same error in a loop.
- Use the standalone terminal instead of the VS Code extension. A commenter on Windows said the problem did not occur from the command prompt, though it still occurred with the extension.
Things that did not help: several users reported that /rewind itself was rejected as not valid inside the VS Code extension, so the recovery step may not be available there.
General advice (not from the thread): if the loop persists, start a fresh session rather than resuming the broken one, and avoid interrupting tool calls mid-run, since an interrupted tool call is a common way to leave a tool_use without its result.
The error log in the report also shows a JSON parse error and a network AggregateError, so the underlying cause may be in the client's handling of tool results rather than in your prompt.
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
Reporter ran Claude Code 2.0.8 on win32 in Windows Terminal and hit a 400 error about tool_use ids without tool_result blocks, with an earlier JSON parse error in the logs. Suggested recovering with /rewind.
Source: https://github.com/anthropics/claude-code/issues/9002 (opens external site)
Did this work for you?What @hyminix tried on GitHub (Partly worked)
Commenter on Windows using the VS Code extension used /rewind before running tools to resume, since retrying on the last conversation looped on the error. Running from the command prompt avoided the problem.
Source: https://github.com/anthropics/claude-code/issues/9002#issuecomment-3378565932 (opens external site)
Did this work for you?What @deebuilt tried on GitHub (Didn't work)
Commenter reported that /rewind was rejected as not valid in the VS Code extension.
Source: https://github.com/anthropics/claude-code/issues/9002#issuecomment-3378678731 (opens external site)
Did this work for you?