continuedev/continue · error · Error
AskSage API error: ${response.status} ${response.statusText}
Error message
AskSage API error: ${response.status} ${response.statusText}: ${errText} What it means
The non-streaming AskSage chat request returned an HTTP error status. The adapter throws with status, statusText, and the response body, and clears its cached token on 401 so the next call re-authenticates.
Source
Thrown at packages/openai-adapters/src/apis/AskSage.ts:361
try {
const headers = await this.getHeaders();
const response = await this.fetchFn(endpoint, {
method: "POST",
headers,
body: JSON.stringify(requestBody),
signal,
});
if (!response.ok) {
const errText = await response.text();
// Clear token cache on 401
if (response.status === 401) {
this.clearTokenCache();
}
throw new Error(
`AskSage API error: ${response.status} ${response.statusText}: ${errText}`,
);
}
const data = (await response.json()) as AskSageResponse;
return this.parseResponse(data, body.model);
} catch (error) {
if (error instanceof Error) {
throw new Error(`AskSage client error: ${error.message}`);
}
throw error;
}
}
async *chatCompletionStream(
body: ChatCompletionCreateParamsStreaming,
signal: AbortSignal,
): AsyncGenerator<ChatCompletionChunk> {View on GitHub (pinned to 5522c6f44c)
Solutions
- Read the status in the message: 401→re-check apiKey/email (token cache is auto-cleared, retry once); 400→validate model/params; 429→back off and retry; 5xx→retry later
- Verify the model name exists in AskSage docs
- Add retry with exponential backoff for 429/5xx
- If 401 persists, verify credentials via the token endpoint directly
Defensive patterns
Strategy: retry
Validate before calling
// Check model name against AskSage docs before calling
if (!ASKSAGE_MODELS.includes(body.model)) throw new Error(`Unknown model ${body.model}`); Try / catch
catch (e) {
const m = String(e);
if (/AskSage API error: 401/.test(m)) return await retryOnce();
if (/AskSage API error: 429|AskSage API error: 5\d\d/.test(m)) return await withBackoff(() => api.chatCompletionNonStream(body, signal));
throw e;
} Prevention
- Implement exponential backoff for 429/5xx
- On 401 let the auto-cleared token cache refresh, then retry once
When it happens
Trigger: AskSage returning 4xx/5xx from its chat endpoint: 401 invalid/expired token, 400 bad request (bad model name), 429 rate limit, 5xx outage.
Common situations: Expired session token after long idle; wrong model identifier; rate limiting under load; AskSage service degradation.
Related errors
- Unsupported transport type: ${this.options.type}
- Error getting prompt: MCP Connection ${serverName} not found
- No MCP authorization code found for ${serverUrl}
- Failed to fetch messages: ${response.statusText}
- Depth must be a number
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/38958e0ea88edca5.
Report an issue: GitHub.