Skip to main content
The Cline API returns errors in a consistent JSON format. HTTP errors come with a non-2xx status code. Mid-stream errors arrive inside the stream body with a 200 OK status.

Error response format

All HTTP errors follow the OpenAI error format:
number | string
The HTTP status code, or a string error identifier for mid-stream errors.
string
A human-readable description of what went wrong.
object
Additional context such as provider details or internal request IDs.

HTTP error codes

Mid-stream errors

When streaming, errors can occur after the HTTP response has started. Because the connection is already open with a 200 OK status, these errors appear as a chunk inside the stream with finish_reason: "error":
Mid-stream errors do not produce an HTTP error code. Always check finish_reason in your streaming handler — do not assume a 200 OK status means the request succeeded.
Common mid-stream error codes:

Retry strategies

When to retry

Exponential backoff

For transient errors (429, 500, 502, 503), retry with exponential backoff to avoid overwhelming the API:

Rate limits

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

Debugging

When reporting an issue, include the following to help diagnose it faster:
  1. The error code and message from the response body
  2. The model ID you were using
  3. The request ID from the x-request-id response header (if present)
  4. Whether the error was immediate (HTTP error) or mid-stream (finish_reason: "error")

Authentication

Verify your API key is set up correctly.

Chat completions

Review request parameters and response format.