Errors
Handle failed turns, command executions, MCP calls, and process errors safely.
The SDK reports structured error items in a turn's items collection and rejects failures that prevent a turn from completing. MCP tool calls expose a failed status and an error message.
Do not treat a command or MCP tool call's non-success status as a successful turn. Preserve the structured item for diagnostics and show the user enough context to decide whether to retry.
Updated Aug 31, 2026