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:

import { InvalidToolApprovalSignatureError } from 'ai';
if (InvalidToolApprovalSignatureError.isInstance(error)) {
// Handle the error
}