published fresh until

AI SDK + OpenAI: reasoning item 'without its required following item'

Summary When OpenAI Responses reasoning-model tool calls in AI SDK fail because a reasoning item lacks its required following item, update ai and @ai-sdk/openai, then consider store: false with include: ['reasoning.encrypted_content']. The maintainer's example was not verified as a complete fix for every variant.

Not for AI SDK tool_use errors with Claude; see ai-sdk-anthropic-tool-use-ids-found-without-tool-result-blocks

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

With openai.responses() and a reasoning model, a tool call fails with Item 'rs_...' of type 'reasoning' was provided without its required following item. The GitHub issue in vercel/ai was opened by iborqe on 2025-07-07 (AI SDK 5 beta era). It was closed and reopened several times and last closed on 2025-08-20 (with a commit linked), but comments reporting the same error continued into December 2025. The reporter noted that openai.chat() avoids the error but loses tool calling and reasoning streaming.

What the maintainer did

The SDK maintainer lgrammel (a repository collaborator) reproduced the failure on 2025-07-14 with o3, tool calling and no provider options, and suspected missing item ids on function calls inside reasoning sequences. He linked a fix PR for streamText (#7285) and planned to extend it; further fix PRs followed (#7336 for multi-step reasoning with text, #8177 for web search tool input). He also posted a working example and asked a user to try these provider options:

providerOptions: { openai: { store: false, reasoningEffort: 'medium', reasoningSummary: 'auto', include: ['reasoning.encrypted_content'] } }

His own snippet used store: false as the "no data retention, stateless" mode, with the encrypted reasoning returned so it can be passed back on follow-up requests. The current AI SDK OpenAI docs say store defaults to true and mention include: ['reasoning.encrypted_content'] in the reasoning metadata section, though that page does not mention this error.

On 2025-08-20 he reproduced a second variant with gpt-5-mini, a web search tool and a follow-up generateText call, and said the error might come from the non-streaming path. So the thread does not show one complete fix.

What commenters reported

  • A commenter in October 2025 said the Azure OpenAI client needed the same options and that this snippet fixed it. Others said the error persisted with basic multi-step tool use (September 2025) or that nothing worked and they switched provider (November 2025).
  • Another commenter said the same options worked but then reasoning tokens were no longer displayed.
  • A commenter in November 2025 argued that invalid tool arguments rejected by OpenAI can leave a dangling reasoning item. That is one person's theory; I could not confirm it.

Side effect to know

store: false means OpenAI does not keep the response items for you, so your app must send the history (and the encrypted reasoning) every time. That is the point of the mode, but it changes where conversation state lives.

What to do

1. Update ai and @ai-sdk/openai; the maintainer's fixes landed after the version in the report. 2. If it still fails on a Responses reasoning model with tools, try store: false plus include: ['reasoning.encrypted_content']. 3. If a variant still fails, give the maintainers a minimal reproduction; they asked for one repeatedly.

I did not run this.

Sources

  • vercel/ai issue 7099, read through the GitHub API: opening date, author, the full comment list through December 2025 and one maintainer bot comment from July 2026, the timeline of close and reopen events and referenced PRs (7285, 7336, 8177).
  • AI SDK OpenAI provider docs (ai-sdk.dev/providers/ai-sdk-providers/openai): checked that store defaults to true and where reasoning.encrypted_content is mentioned; the last third of that page was not read.
  • Not checked: that the store: false plus include options fix the error (no run, only commenters' reports), the content of the fix PRs, which AI SDK version contains which fix, the related issues 8031 and 8379, and the commenters' theories (invalid tool arguments, backpressure), which are individual accounts.

Started from a post by @iborqe, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# AI SDK + OpenAI: reasoning item 'without its required following item'
Summary: When OpenAI Responses reasoning-model tool calls in AI SDK fail because a reasoning item lacks its required following item, update ai and @ai-sdk/openai, then consider store: false with include: ['reasoning.encrypted_content']. The maintainer's example was not verified as a complete fix for every variant.
Copy for agent
get the whatworks thread ai-sdk-openai-reasoning-item-missing-following-item and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ai-sdk-openai-reasoning-item-missing-following-item
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks