Repository navigation
BadRequestError: tool_call_id not found when using Claude/OpenAI with session history containing tool calls #4348
Description
🔴 Required Information
Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected/deprioritized.
If an item is not applicable to you, please mark it as N/A
Describe the Bug:
When using Claude via Vertex AI or OpenAI models with ADK, replaying session history that contains tool calls results in a BadRequestError because tool_call_id is missing.
Steps to Reproduce:
- Use ADK with session continuity (loading previous session events)
- The previous session contains tool calls (function_call and function_response)
- Use Claude via Vertex AI or the OpenAI model via LiteLLM
- Send a follow-up message that requires replaying the session history
Root Cause Analysis
- Gemini API returns id=None for function calls
- ADK's populate_client_function_call_id() generates adk-{uuid} IDs to fill this gap
- Before sending history to LLM, remove_client_function_call_id() strips all adk-* prefixed IDs, setting them to None
- Claude via Vertex AI and OpenAI requires tool_call_id on tool response messages to match them to function calls
- With IDs stripped, these models fail with BadRequestError
Expected Behavior:
Session history with tool calls should work correctly with Claude/OpenAI models. The adk-* function call IDs should be preserved since:
- Claude via Vertex AI requires tool_call_id
- OpenAI models require a matching tool_call_id
- Gemini ignores extra IDs (generates its own or uses None)
Observed Behavior:
What actually happened? Include error messages or crash stack traces here.
Environment Details:
- ADK version: 1.2.3+
- Python version: 3.11
- Model: Claude via Vertex AI (also affects OpenAI via LiteLLM)
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: Claude via Vertex AI (also affects OpenAI via LiteLLM)
🟡 Optional Information
Providing this information greatly speeds up the resolution process.
Regression:
Did this work in a previous version of ADK? If so, which one? No
Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.
litellm.BadRequestError: litellm.BadRequestError: VertexAIException BadRequestError -
{'error': {'message': "tool_call_id '...' not found in list of function calls in the chat history"}}
How often has this issue occurred?:
- Always (100%)
Activity
klateefa commentedon Feb 13, 2026
@thesynapses
Sorry for the delayed response. Please upgrade to the latest version
(google-adk==1.25.0)and let us know if the issue still occurs.It would be very helpful for our analysis if you could share your observations after testing this version.Thank you.
thesynapses commentedon Feb 13, 2026
Already filed a PR for this please check. I dont thing 1.25 has this fix.
klateefa commentedon Apr 17, 2026
@thesynapses Thanks for confirming. A fix is in progress (PR #4349). Please try again once it’s merged and let us know if you still see the issue.
Thanks for your patience.
goeffthomas commentedon May 28, 2026
Is there any reason this has stalled?
GWeale commentedon Jun 17, 2026
This was fixed in commit f0c787f (function call IDs are now preserved for Anthropic models on session replay), linked from #4349. Closing as fixed. If you still hit it specifically on OpenAI/LiteLLM, please reopen with a repro and I'll take another look.