AI SDK "No Tool Call Found" on Follow-Up? Fix previousResponseId

AI SDK "No Tool Call Found" on Follow-Up? Fix previousResponseId

Aident AI

Cyan and coral ribbons stay paired through a translucent indigo handoff plane with an amber bridge.

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:

  1. The model uses the OpenAI Responses API through @ai-sdk/openai.

  2. Turn one succeeds and returns a response ID.

  3. A later turn sets providerOptions.openai.previousResponseId.

  4. The model makes a new plain client-executed function call.

  5. The next request returns HTTP 400 with a missing call_id message.

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:

const result = streamText({
  model: openai.responses('gpt-4.1-mini'),
  messages: completeModelHistory,
  tools: { searchCatalog },
  stopWhen: stepCountIs(3),
});

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:

  1. Pin the exact ai and @ai-sdk/openai versions under test.

  2. Force one tool call on turn one and confirm it executes once.

  3. Send a second turn using complete message history and no previousResponseId.

  4. Force a new tool call and confirm it executes once.

  5. Confirm the stream reaches final text without HTTP 400.

  6. 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

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.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

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.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.

Try Aident Loadout

Give your Agent real capabilities in minutes. Connect 1,000+ tools, and let your agents execute.