Skip to main content
The Cline API returns errors in a consistent JSON format. Understanding these errors helps you build reliable integrations.

Error Format

All errors follow the OpenAI error format:

Error Codes

HTTP Errors

These are returned as the HTTP response status code and in the error body:

Mid-Stream Errors

When streaming, errors can occur after the response has started. These appear as a chunk with finish_reason: "error":
Common mid-stream error codes:
Mid-stream errors do not produce an HTTP error code (the connection was already 200 OK). Always check finish_reason in your streaming handler.

Retry Strategies

Exponential Backoff

For transient errors (429, 500, 502, 503), retry with exponential backoff:

When to Retry

Rate Limits

If you hit rate limits frequently:
  • Add delays between requests
  • Reduce the number of concurrent requests
  • Contact support if you need higher limits

Debugging

When reporting issues, include:
  1. The error code and message from the response
  2. The model ID you were using
  3. The request ID (from the x-request-id response header, if available)
  4. Whether the error was immediate (HTTP error) or mid-stream (finish_reason error)

Chat Completions

Endpoint reference with request and response schemas.

Authentication

Verify your API key is configured correctly.