AI_InvalidToolApprovalError

This error occurs when a tool approval response references an unknown approvalId. No matching tool-approval-request was found in the message history.

Properties

  • approvalId: The approval ID that was not found
  • message: The error message

Checking for this Error

You can check if an error is an instance of AI_InvalidToolApprovalError using:

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