The Cline API returns errors in a consistent JSON format. Understanding these errors helps you build reliable integrations.Documentation Index
Fetch the complete documentation index at: https://docs.cline.bot/llms.txt
Use this file to discover all available pages before exploring further.
Error Format
All errors follow the OpenAI error format:| Field | Type | Description |
|---|---|---|
code | number/string | HTTP status code or error identifier |
message | string | Human-readable description of the error |
metadata | object | Additional context (provider details, request IDs) |
Error Codes
HTTP Errors
These are returned as the HTTP response status code and in the error body:| Code | Name | Cause | What to do |
|---|---|---|---|
400 | Bad Request | Malformed request body, missing required fields | Check your JSON syntax and required parameters |
401 | Unauthorized | Invalid or missing API key | Verify your API key in the Authorization header |
402 | Payment Required | Insufficient credits | Add credits at app.cline.bot |
403 | Forbidden | Key does not have access to this resource | Check key permissions |
404 | Not Found | Invalid endpoint or model ID | Verify the URL and model ID format |
429 | Too Many Requests | Rate limit exceeded | Wait and retry with exponential backoff |
500 | Internal Server Error | Server-side issue | Retry after a short delay |
502 | Bad Gateway | Upstream provider error | Retry after a short delay |
503 | Service Unavailable | Service temporarily down | Retry after a short delay |
Mid-Stream Errors
When streaming, errors can occur after the response has started. These appear as a chunk withfinish_reason: "error":
| Code | Meaning |
|---|---|
context_length_exceeded | Input tokens exceed the model’s context window |
content_filter | Content was blocked by a safety filter |
rate_limit | Rate limit hit during generation |
server_error | Upstream provider failed during generation |
Retry Strategies
Exponential Backoff
For transient errors (429, 500, 502, 503), retry with exponential backoff:When to Retry
| Error | Retry? | Strategy |
|---|---|---|
401 Unauthorized | No | Fix your API key |
402 Payment Required | No | Add credits |
429 Too Many Requests | Yes | Exponential backoff (start at 1s) |
500 Internal Server Error | Yes | Retry once after 1s |
502 Bad Gateway | Yes | Retry up to 3 times with backoff |
503 Service Unavailable | Yes | Retry up to 3 times with backoff |
Mid-stream error | Depends | Retry the full request for transient errors |
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:- The error code and message from the response
- The model ID you were using
- The request ID (from the
x-request-idresponse header, if available) - Whether the error was immediate (HTTP error) or mid-stream (finish_reason error)
Related
Chat Completions
Endpoint reference with request and response schemas.
Authentication
Verify your API key is configured correctly.

