Aident AI

AI SDK "No Tool Call Found" on Follow-Up? Fix previousResponseId
If a Vercel AI SDK follow-up turn fails with No tool call found for function call output with call_id, first check whether the request combines OpenAI Responses, previousResponseId, stored responses, and a plain client-executed tool. The bug reproduced on AI SDK 6 and 7, but not on the tested AI SDK 5 release line. Until the upstream patch ships in a release, omit previousResponseId on the affected tool-enabled path and resend the complete trusted message history so every tool output stays paired with its tool call.
Do not invent a call_id, replay the tool blindly, or strip the tool result. Those changes can hide the pairing failure while duplicating a write.
Confirm the Exact Failure Shape
The error text alone is not enough. Confirm these conditions:
The model uses the OpenAI Responses API through
@ai-sdk/openai.Turn one succeeds and returns a response ID.
A later turn sets
providerOptions.openai.previousResponseId.The model makes a new plain client-executed function call.
The next request returns HTTP 400 with a missing
call_idmessage.
The upstream reproduction used ai@7.0.55 with @ai-sdk/openai@4.0.33 on main, and ai@6.0.244 with @ai-sdk/openai@3.0.90 on the version 6 branch. The maintainers' automated reproduction did not trigger the bug on ai@5.0.228 with @ai-sdk/openai@2.0.117 because that branch does not contain the same conversion guard.
This is different from a tool schema error, a tool execution exception, or a provider-defined tool failure. If arguments arrive as strings or the generated schema is empty, use the MCP tool argument and schema guide instead.
Why previousResponseId Breaks the Pair
OpenAI function calling requires a tool result to reference the corresponding function call by call_id. In the affected AI SDK conversion path, a follow-up request can omit the plain client function call while still sending its function-call output. OpenAI then sees an output with no matching call and rejects the request.
The upstream issue traces the mismatch to convert-to-openai-responses-input.ts. A guard skips stored tool calls that carry an item ID whenever previousResponseId is present. The later provider-defined-tool guard is narrower, but the earlier guard also catches plain client tools before they can fall through to the normal function-call conversion.
The open fix in Vercel AI pull request 18543 restricts that skip to provider-defined tools. It keeps a plain client function call beside its output and adds regression coverage for the chained turn. As of August 6, 2026, the pull request is open and no released package version is cited as containing the patch.
Use Full Message History as the Temporary Fallback
For the affected route, stop using response-ID chaining and send the complete validated model history:
The important change is the absence of previousResponseId. completeModelHistory must contain the relevant user messages, assistant tool calls, and tool results in their original order. If your application stores UI messages, follow the AI SDK's message persistence guide to validate and convert them before calling streamText.
This fallback trades the compact response-ID handoff for a larger request. Bound the history, preserve required context, and summarize only completed older turns. Never accept client-supplied tool results without server-side validation.
If your application already has a tested AI SDK 5 deployment, staying on that release line until the patch is published may be reasonable. Do not downgrade a production AI SDK 6 or 7 application casually: major-version changes can alter message formats, tool contracts, and provider behavior.
Prevent Duplicate Tool Writes During Recovery
A failed streamed turn can leave uncertainty about whether a client tool ran before the provider rejected the next step. Recover with a read-only or idempotent tool first.
For tools that create, charge, send, or mutate:
persist an idempotency key before execution;
record tool-call start and completion separately;
check the provider or database before retrying;
never retry only because the stream surfaced an error; and
show the user which operation is safe to resume.
The provider error describes a request-pairing problem, not proof that the tool did nothing. Treat execution state and conversation state as separate boundaries.
If your application already queues non-parallel writes, keep that boundary explicit. The Vercel AI SDK pending-queue pattern shows how to serialize a tool without confusing queue state with model conversation state.
Verify the Workaround With Two Forced Tool Turns
Use a disposable read-only tool and make the test deterministic:
Pin the exact
aiand@ai-sdk/openaiversions under test.Force one tool call on turn one and confirm it executes once.
Send a second turn using complete message history and no
previousResponseId.Force a new tool call and confirm it executes once.
Confirm the stream reaches final text without HTTP 400.
Inspect sanitized request item types and verify every function-call output has a matching function call.
Log item types and opaque correlation hashes, not prompts, tool payloads, credentials, or raw provider IDs. The success condition is two completed turns, two single tool executions, and no orphaned output.
After a release includes pull request 18543, restore previousResponseId in a canary and repeat the same test. Upgrade ai and @ai-sdk/openai to compatible versions from the same supported release line. Do not infer that the fix shipped merely because the pull request merged.
Monitor the Fix Without Rechecking GitHub Manually
Aident Loadout can query the connected GitHub issue surface without putting a provider token in your prompt. Give Codex the canonical setup instruction:
Follow https://aident.ai/SETUP.md
Then use this bounded prompt:
Check my Aident Loadout account and Vault status. Find a connected read-only GitHub issue search Action, inspect its current schema, and preflight it. Return the state, updated time, merge status, release references, and maintainer-authored verification notes for vercel/ai issue 18537 and pull request 18543. Do not create or edit issues, post comments, change files, or ask for a provider key.
Success is measurable: you receive two current records, the Action performs zero GitHub writes, and no credential appears in the prompt or result. Ready to track the release safely? Set up Aident Loadout and run the read-only check.
Sources
Vercel AI issue 18537: follow-up tool call loses its matching call
Vercel AI pull request 18543: preserve client tool calls on follow-up turns
Refresh this guide when pull request 18543 changes state, a release note names the fix, the affected version matrix changes, or the two-turn canary no longer reproduces the failure.



The one tool
for every tool
your agent needs.
Give any AI agent real capabilities in seconds. Connect 1,000+ tools once, skip the setup headache, and let your agents execute.
