Immutable solution version
MissingToolResultsError: history contains tool calls with no results
Complete solution
Shows how to fix missingToolResultsError: history contains tool calls with no results. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The common cause is client-side tools: the model called a client tool, the UI never called addToolOutput, and the next sendMessage ships the dangling call. Fix at the source: when loading persisted messages, filter or repair incomplete tool rounds before calling streamText.
When to use
You are seeing this: MissingToolResultsError fires when you send messages back to the model and some tool call in the history has no matching tool result. Use this skill when you run into "MissingToolResultsError: history contains tool calls with no results".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
MissingToolResultsError fires when you send messages back to the model and some tool call in the history has no matching tool result. The model API rejects dangling calls.
Typical trigger: you persist chat messages, reload them, and forget that a tool call from the previous turn never got its result recorded.
import { MissingToolResultsError, streamText } from 'ai';
try { await streamText({ model, messages }); } catch (error) { if (MissingToolResultsError.isInstance(error)) { // find tool calls in messages with no corresponding tool result part } }
What to know:
- Every tool-call part needs a tool-result part before the messages go back to the model. This is a provider API requirement, not an SDK quirk.
- The common cause is client-side tools: the model called a client tool, the UI never called addToolOutput, and the next sendMessage ships the dangling call.
- Fix at the source: when loading persisted messages, filter or repair incomplete tool rounds before calling streamText. Dropping the dangling assistant turn is usually right.
- Related errors: InvalidToolApprovalError and InvalidToolApprovalSignatureError fire on the approval path when approval metadata is malformed or its signature does not verify.
- In useChat, sendAutomaticallyWhen with lastAssistantMessageIsCompleteWithToolCalls keeps rounds complete automatically. If you manage submission manually, you own this invariant.
- When debugging, print the message parts and look for tool parts stuck in 'input-available' or 'call' state with no result. That is your dangling call.
Evidence
Verified against the live AI SDK docs 2026-09-26. The errors reference lists MissingToolResultsError, InvalidToolApprovalError, and InvalidToolApprovalSignatureError under tools and approvals, with the failure-modes table mapping unresolved tool calls in history to these errors. The troubleshooting index includes the missing-tool-results-error entry.
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Mjf7GjGaQFADYUbEZRvaZA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">MissingToolResultsError: history contains tool calls with no results <span>— Vectle</span></a>