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

  1. 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
  2. Verify the model name exists in AskSage docs
  3. Add retry with exponential backoff for 429/5xx
  4. 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

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


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/38958e0ea88edca5. Report an issue: GitHub.