Skip to content

Beta 5 - Incomplete tool input part breaking the whole chat history #7097

@RicSala

Description

@RicSala

Description

When there is an invalid tool call in history, the convertToModelMessages fails to convert to model messages, breaking the whole experience and forcing the user to start a new chat session. It should probably just be ignored so the user can keep with their chat session.

After a tool has called with invalid input, the user cannot move forward in the same chat session as it throws this:

Chat Client Tools API error: Error [AI_MessageConversionError]: incomplete tool input is not supported: call_cFYQgCzSZOqMLrd0EAeNrIMY
    at POST (src/app/api/chat-client-tools/route.ts:11:39)
   9 |     const result = streamText({
  10 |       model: openai('gpt-4o-mini'),
> 11 |       messages: convertToModelMessages(messages),
     |                                       ^
  12 |       tools: {
  13 |         updateSlide,
  14 |       }, {
  cause: undefined,
  originalMessage: [Object]
}
 POST /api/chat-client-tools 500 in 80ms

AI SDK Version

"@ai-sdk/openai": "2.0.0-beta.5",
"@ai-sdk/react": "2.0.0-beta.7",

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions