Errors
Revised
Status codes
Endpoints respond with1 appropriate HTTP status codes based on the success or failure of the request in the HTTP status line (for example,2 HTTP/1.1 200 OK or HTTP/1.1 400 Bad Request). Common status codes are:
200: Success400: Bad Request (missing parameters, invalid JSON, and so on3)404: Not Found (model doesn't exist, and so on4)429: Too Many Requests (for example,5 when a rate limit is exceeded)500: Internal Server Error502: Bad Gateway (for example,6 when a cloud model can't7 be reached)X23
Error messages
Errors are returned in the application/json format with the following structure, with the error message in the error property:
{
"error": "the model failed to generate a response"
}
Errors that occur while streaming
If an error occurs mid-stream, the error is returned8 as an object in the application/x-ndjson format with an error property. Since the response has already started, the status code of the response won't change9.X19
{"model":"gemma4","created_at":"2025-10-26T17:21:21.196249Z","response":" Yes","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.207235Z","response":".","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.219166Z","response":"I","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.231094Z","response":"can","done":false}
{"error":"an error was encountered while running the model"}
Notes on this page
1 Wording Audit: improved An endpoint responds with a status code; it does not return one.
Was:
Endpoints returnReturnsRespondsAuditor: “Respond with” is clear and preserves the point that endpoints communicate status codes.
2 Wording Audit: improved The standard writes for example in place of the Latin abbreviation.
Was:
e.g.LatinAuditor: Spelling out “for example” follows the standard and preserves the example.
3 Wording Audit: improved The standard writes and so on in place of the Latin abbreviation.
Was:
etc.LatinAuditor: Replacing “etc.” with “and so on” follows the standard without changing the meaning.
4 Wording Audit: improved The standard writes and so on in place of the Latin abbreviation.
Was:
etc.LatinAuditor: Replacing “etc.” with “and so on” follows the standard without changing the meaning.
5 Wording Audit: improved The standard writes for example in place of the Latin abbreviation.
Was:
e.g.LatinAuditor: Spelling out “for example” follows the standard and preserves the example.
6 Wording Audit: improved The standard writes for example in place of the Latin abbreviation.
Was:
e.g.LatinAuditor: Spelling out “for example” follows the standard and preserves the example.
7 Wording Audit: improved Uses a contraction as the voice asks.
Was:
cannotContractionsAuditor: “Can’t” is a plain contraction that preserves the meaning of “cannot.”
8 Wording Audit: improved Uses the present tense for what is true now.
Was:
will be returnedvoice-present-tenseAuditor: “Is returned” states the behavior in the present tense without changing the conditional instruction.
9 Wording Audit: improved Uses the present tense and a contraction; the meaning is unchanged.
Was:
will not be changedvoice-present-tenseContractionsAuditor: “Won’t change” uses present tense and a contraction while preserving the meaning.
Questions for the owner
X19 How errors are reported during streaming. The Errors page says a mid-stream error arrives as an object in the stream with the status unchanged; Anthropic compatibility lists the
errorevent as supported and also lists server-senterrorevents as not supported because errors return an HTTP status. Does the Anthropic-compatible endpoint emiterrorevents mid-stream, and how should that relate to the Errors page?Pages: Errors, Anthropic compatibility
X23 Errors page omits the 503 overload status. The FAQ says the local server returns 503 when its queue is full, but the Errors page's list of common status codes has no 503. Should 503 be added to the Errors page's status codes?
Original
Status codes
Endpoints return appropriate HTTP status codes based on the success or failure of the request in the HTTP status line (e.g. HTTP/1.1 200 OK or HTTP/1.1 400 Bad Request). Common status codes are:
200: Success400: Bad Request (missing parameters, invalid JSON, etc.)404: Not Found (model doesn't exist, etc.)429: Too Many Requests (e.g. when a rate limit is exceeded)500: Internal Server Error502: Bad Gateway (e.g. when a cloud model cannot be reached)
Error messages
Errors are returned in the application/json format with the following structure, with the error message in the error property:
{
"error": "the model failed to generate a response"
}
Errors that occur while streaming
If an error occurs mid-stream, the error will be returned as an object in the application/x-ndjson format with an error property. Since the response has already started, the status code of the response will not be changed.
{"model":"gemma4","created_at":"2025-10-26T17:21:21.196249Z","response":" Yes","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.207235Z","response":".","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.219166Z","response":"I","done":false}
{"model":"gemma4","created_at":"2025-10-26T17:21:21.231094Z","response":"can","done":false}
{"error":"an error was encountered while running the model"}
What Changed
Latin abbreviations are spelled out, the verb for what an endpoint does with a status code is the standard one, and two sentences move to the present tense with contractions. The missing 503 and the streaming error conflict are attached as inventory questions; the page's own wording is kept on both.
Content type: reference. The page lists status codes, the error message format, and the streaming error shape for lookup.
Automated check, original: 0 errors, 5 warnings, 3 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.
Independent audit (GPT-6): improved. The wording changes make the page more consistent with the standard while preserving its meaning. The revision leaves two inventory markers without readable questions, so the owner cannot tell what needs review.
What the revision missed:
- The revision contains X23 and X19 inventory markers, but notes/api/errors.json has no corresponding question text, so the stated inventory questions are not actually presented for the documentation owner to answer.
Wording (9)
- 1 An endpoint responds with a status code; it does not return one. improved
- 2 The standard writes for example in place of the Latin abbreviation. improved
- 3 The standard writes and so on in place of the Latin abbreviation. improved
- 4 The standard writes and so on in place of the Latin abbreviation. improved
- 5 The standard writes for example in place of the Latin abbreviation. improved
- 6 The standard writes for example in place of the Latin abbreviation. improved
- 7 Uses a contraction as the voice asks. improved
- 8 Uses the present tense for what is true now. improved
- 9 Uses the present tense and a contraction; the meaning is unchanged. improved