ai@6.0.331
AI SDK 6.0.331 fixes high memory/CPU usage during malformed UI message validation and updates tool call error message consistency.
Why this signal matters
Vercel AI SDK patch release ai@6.0.331 introduces key validation and error handling updates: - UI Message Validation Optimization: Fixes a potential denial-of-service/exhaustion risk in validateUIMessages, safeValidateUIMessages, and agent UI stream helpers. Previously, issue reporting ran every part schema against every invalid part; validation is now restricted to the schemas matching the part's type, halts upon encountering the first invalid message or part, and consolidates invalid JSON metadata into a single reported issue. - Tool Call Error Consistency: By default, error text from failed tool calls now maintains consistency with the model's message history. Users can supply redactToolErrors: true to mask the error text with the onError callback output. - Dependency updates: Includes updates to @ai-sdk/gateway@3.0.236.
Actionable summary
AI SDK version 6.0.331 resolves an issue where validating malformed UI messages caused memory and CPU exhaustion by restricting schema validation per part type and failing fast. It also aligns default tool call error text with model history while introducing a redactToolErrors option.
- Agent usefulness
- 77/100
- Confidence
- 96%
- Canonical data
- JSON + Markdown
What builders should check
- Upgrade to ai@6.0.331 to prevent CPU and memory exhaustion when handling malformed UI messages.
- Set redactToolErrors: true if you need to conceal tool error text from model history using the onError callback.