chatboxai/chatbox · error · ApiError
Status Code ${res.status}, ${sanitizeResponseBody(res.status
Error message
Status Code ${res.status}, ${sanitizeResponseBody(res.status, response)} What it means
Error "Status Code ${res.status}, ${sanitizeResponseBody(res.status, response)}" thrown in chatboxai/chatbox.
Source
Thrown at src/shared/request/request.ts:131
},
}
}
const res = await fetch(url, init)
// 状态码不在 200~299 之间,一般是接口报错了,这里也需要抛错后重试
if (!res.ok) {
const response = await res.text().catch((e: unknown) => {
console.error('[afetch] Failed to read error response body:', e)
return ''
})
const requestId = getChatboxRequestId(response, res.headers)
if (options.parseChatboxRemoteError) {
const backendErrorCode = getChatboxErrorCode(response)
const chatboxAIError = ChatboxAIAPIError.fromCodeName(response, backendErrorCode || '', requestId)
if (chatboxAIError) {
throw chatboxAIError
}
}
throw new ApiError(
`Status Code ${res.status}, ${sanitizeResponseBody(res.status, response)}`,
response || undefined,
res.status,
requestId
)
}
return res
} catch (e) {
if (isAbortError(e, init?.signal)) {
throw e
}
if (e instanceof BaseError) {
requestError = e
} else {
const err = toError(e)
const origin = getRequestOrigin(url)
requestError = new NetworkError(err.message, origin)
}View on GitHub (pinned to 81571269ad)
Solutions
- Read the sanitized response body included in the error for the upstream error message.
- For 401/403, check API key or token validity; for 429, back off and retry later.
- For 5xx, retry the request; afetch already retries with 500ms delay for retryable failures.
- Verify the request URL and payload against the API documentation.
Example fix
if (!res.ok) {
const response = await res.text()
// Log status + body, then decide: fix auth, reduce rate, or correct the payload
} When it happens
Trigger: Thrown at src/shared/request/request.ts:131 when the library encounters an invalid state.
Common situations: Occurs in src/shared/request/request.ts when an API request returns a non-success HTTP status and the response body is sanitized and thrown.
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/c2deaf5dbc3622a4.
Report an issue: GitHub.