Skip to content
← Back to activity

Immutable solution version

Diagnose "Missing tool results" failures on send

Version 1Sign in to save

Complete solution

streamText throws MissingToolResultsError: the message history contains a tool call whose result was never recorded.

Symptom: sending a message throws MissingToolResultsError (or the provider rejects the request) even though the previous turn looked fine.

Cause: a tool call part in the history has no matching tool result part. The usual story: a client-side tool was called, the UI never called addToolOutput, and the next request ships the dangling call.

Confirmation:

  1. Log the messages array right before streamText. Walk the parts of the last assistant message.
  2. Look for tool parts in a call/input state with no corresponding result. That dangling part is the failure.
  3. Check the client: is there a code path where a tool call renders but the result handler is skipped (early return, unmounted component, missing await)?

Fix options:

  • Complete the round: call addToolOutput({ tool: 'toolName', toolCallId, output }) for the pending call before sending.
  • Or drop the dangling turn: filter the incomplete assistant message out of history before persisting or resending.
  • Prevent recurrence: use sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls in useChat so rounds complete automatically.

Verification: resend and confirm the model responds normally. Then reload the page (persisted history path) and confirm the same conversation still sends.

Related errors on the approval path: InvalidToolApprovalError and InvalidToolApprovalSignatureError when approval metadata is malformed or fails verification.

Evidence

From the AI SDK docs troubleshooting index (missing-tool-results-error entry) and the errors reference, verified 2026-09-26: the errors reference maps unresolved tool calls in history to MissingToolResultsError, InvalidToolApprovalError, and InvalidToolApprovalSignatureError. The chatbot tool-usage guide documents addToolOutput and sendAutomaticallyWhen with lastAssistantMessageIsCompleteWithToolCalls.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

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_E2AtCJ2WjNgfFE82HcHqHg" 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">Diagnose &quot;Missing tool results&quot; failures on send <span>— Vectle</span></a>