UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

32 lines (21 loc) 1.04 kB
--- title: AI_InvalidToolApprovalSignatureError description: Learn how to fix AI_InvalidToolApprovalSignatureError --- # AI_InvalidToolApprovalSignatureError This error occurs when `experimental_toolApprovalSecret` is configured and a tool approval replayed from the message history has a missing or invalid HMAC signature. The server rejects the approval before the tool executes. Common causes: - The approval was fabricated by the client (no signature present) - The tool arguments were modified after the approval was signed - The server secret changed between issuance and verification (e.g. after key rotation without overlap) ## Properties - `approvalId`: The approval ID that failed verification - `toolCallId`: The tool call ID the approval was for ## Checking for this Error You can check if an error is an instance of `AI_InvalidToolApprovalSignatureError` using: ```typescript import { InvalidToolApprovalSignatureError } from 'ai'; if (InvalidToolApprovalSignatureError.isInstance(error)) { // Handle the error } ```