Error thrown/streamed when a chat/LLM job fails, preserving the server's error contract so apps can branch on machine-readable fields instead of string-matching .message.

message stays the human-readable server message (unchanged from the plain Error this class replaces). code/errorCode carry the wire error code when present — for jobs submitted with billingMode: 'subscription', the subscription denial codes from SUBSCRIPTION_ERROR_CODES ('4078' not entitled, '4080' billing-grace renewal retry). errorType carries the server's error tag, e.g. 'subscription_unavailable'.

try {
for await (const chunk of stream) { ... }
} catch (err) {
if (err instanceof ChatJobError && err.errorType === 'subscription_unavailable') {
// offer a "pay with Spark/SOGNI" fallback instead of retrying
}
}

Hierarchy

  • Error
    • ChatJobError

Constructors

Properties

code?: string

Server error code as a string (e.g. '4080'), when the failure carries one.

errorCode?: string

Alias of ChatJobError.code for consumers that branch on errorCode.

errorType?: string

Server error type tag (e.g. 'subscription_unavailable'), when present.

feature?: string

Stable machine key for the gated capability, e.g. 'video_4k_render'.

jobID?: string

Chat job id the failure belongs to, when known.

limitation?: string

Standalone user-facing English describing the limitation.

payload?: unknown

Raw error payload as received from the server.

requiredPlans?: SubscriptionPlanId[]

Plans that would satisfy the gated feature, cheapest-first.

status?: number

HTTP status when the failure came from a REST chat endpoint.

subscriptionLimit?: boolean

true when this failure is a subscription FEATURE-gate denial (4081).

Accessors