You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Each tool_use block must have a corresponding tool_result block in the next message #3504
Describe the bug
The detail error message like below:
litellm.exceptions.BadRequestError: litellm.BadRequestError: AnthropicException - {"type":"error","error":{"type":"invalid_request_error","message":"messages.4: tool_use ids were found without tool_result blocks immediately after: toolu_014qrA41Neqm6NHZTstHQfCm. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CV3JFQ1toRhQLqcqR7KDE"}
To Reproduce
Using cloude4.5 mounted by litellm, if there is no response from the tool call in the conversation, the above error will be reported.
You can no longer continue the conversation in this session.
ADK emits the tool_result immediately after every tool_use, so Claude only raises that error when the stored transcript drops the function_response. Can you look more into the Vertex session history you’re replaying and ensure each tool_use event is followed by its matching tool_result (even if empty).
If the persisted history is missing the tool_result, Claude will refuse to continue, there’s no way for ADK to recover that turn. Please make sure whatever is saving to Vertex/LiteLLM always stores the function_response event ADK emits right after each tool finishes; otherwise you must either backfill the missing tool_result or start a new session.
Activity
hongliang-nemovideo commentedon Nov 12, 2025
I use the vertex session service to save the context.
GWeale commentedon Nov 12, 2025
ADK emits the tool_result immediately after every tool_use, so Claude only raises that error when the stored transcript drops the function_response. Can you look more into the Vertex session history you’re replaying and ensure each tool_use event is followed by its matching tool_result (even if empty).
hongliang-nemovideo commentedon Nov 12, 2025
yes,there is no a matching tool_result in the sessin history. But I can't understand the session can't continue any more...
hongliang-nemovideo commentedon Nov 12, 2025
now, I start to find result in the liteLlm module.
GWeale commentedon Nov 12, 2025
If the persisted history is missing the tool_result, Claude will refuse to continue, there’s no way for ADK to recover that turn. Please make sure whatever is saving to Vertex/LiteLLM always stores the function_response event ADK emits right after each tool finishes; otherwise you must either backfill the missing tool_result or start a new session.
hongliang-nemovideo commentedon Nov 12, 2025
I found a close issue in liteLlm resp
BerriAI/litellm#12404
I'm trying...
hongliang-nemovideo commentedon Nov 12, 2025
not work...
GWeale commentedon Nov 17, 2025
Hi @hongliang-nemovideo Thank you for pointing this out, we just put a fix in for this. If it is not working after the next release please reopen!
fix: keep vertex session event history intact
fix: keep vertex session event history intact
fix: keep vertex session event history intact