Skip to main content
The Decart provider uses the AI SDK’s error handling system and throws specific error types for different failure scenarios. This guide covers common errors and how to handle them.

Error Types

AISDKError

The primary error type used by the Decart provider. All runtime errors are instances of AISDKError from the @ai-sdk/provider package.

NoSuchModelError

Thrown when attempting to use an unsupported model type (e.g., trying to call languageModel() or textEmbeddingModel() on the Decart provider).
The Decart provider only supports image and video models. Language models and text embedding models are not supported.

Common Error Scenarios

API Authentication Errors

Occur when the API key is missing, invalid, or expired. Error pattern:
Solution:
Ensure your DECART_API_KEY environment variable is set or pass apiKey explicitly when creating the provider.

Timeout Errors

Occur when video generation takes longer than the configured pollTimeoutMs. Error pattern:
Solution:

Job Failure Errors

Occur when the video generation job fails on the server side. Error pattern:
Solution:

Abort Signal Errors

Occur when a request is cancelled via an AbortSignal. Error pattern:
Solution:

Network Errors

Occur when the network request fails (connection issues, DNS failures, etc.). Error pattern:
Solution:

Warnings

The Decart provider returns warnings for unsupported settings that don’t cause failures but are ignored.

Unsupported Settings

When you provide settings that aren’t supported by the model, warnings are included in the response:
Warnings don’t prevent video generation. The unsupported parameters are simply ignored, and generation proceeds with supported settings.

Best Practices

Comprehensive Error Handling

Implement robust error handling for production applications:

Retry Strategy

Implement exponential backoff for transient errors:

Validation Before API Calls

Validate inputs before making API calls to catch errors early:

Debugging Tips

Enable Request Logging

Use a custom fetch function to log all requests:

Check API Status

If you’re experiencing errors, verify the Decart API status and your account:
  1. Check the Decart Status Page for any service disruptions
  2. Verify your API key is valid and hasn’t expired
  3. Check your account quota and usage limits