Skip to main content

Function: classifyFailure()

classifyFailure(error, policy?): FailureClass

Defined in: packages/core/src/core/durability.ts:64

Classify a failed attempt. The host's policy.classify answers first; undefined from it falls through to the defaults:

  • ExecutionStoppedError (including IncompatibleDefinitionError), here or in a cause: permanent.
  • RequiredExecutionError (a journal write failed or conflicted) and a bare JournalConflictError (another writer moved the revision): infrastructure.
  • An AI SDK APICallError with status 401 (unauthorized) or 402 (credits-exhausted), here, in a cause or as a RetryError's last error: permanent. Asking again cannot succeed.
  • Anything else, including AI SDK's retryable APICallError, RetryError and timeouts: transient, bounded by maxAttempts.

Parameters​

error​

unknown

policy?​

RunPolicy

Returns​

FailureClass