decolua/9router · error · Error

Antigravity API error: ${response.status}

Error message

Antigravity API error: ${response.status}

What it means

getAntigravityUsage calls the Antigravity quota API and throws this error when the response status is not OK and not the handled 401-auth-expired case. Unlike 401 (which returns a graceful 'authentication expired' object), any other non-2xx status (403, 429, 5xx) surfaces as a raw status code with no body detail.

Source

Thrown at open-sse/services/usage/google.js:154

      }),
    }, 10000, proxyOptions);

    if (response.status === 403) {
      return {
        message: "Antigravity quota API access forbidden. Chat may still work.",
        quotas: {}
      };
    }

    if (response.status === 401) {
      return {
        message: "Antigravity quota API authentication expired. Chat may still work.",
        quotas: {}
      };
    }

    if (!response.ok) {
      throw new Error(`Antigravity API error: ${response.status}`);
    }

    const data = await response.json();
    const quotas = {};

    // Parse model quotas (inspired by vscode-antigravity-cockpit)
    if (data.models) {
      // Filter only recommended/important models (must match PROVIDER_MODELS ag ids)
      const importantModels = [
        'gemini-3.7-flash-high',
        'gemini-3.7-flash-medium',
        'gemini-3.7-flash-low',
        'gemini-3.6-flash-high',
        'gemini-3.6-flash-medium',
        'gemini-3.6-flash-low',
        'gemini-3.5-flash-low',
        'gemini-3.5-flash-extra-low',
        'gemini-pro-agent',

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Check response.status via the message: 429 → back off and retry later; 403 → re-auth with correct scopes; 5xx → retry after delay
  2. Re-run the Antigravity OAuth flow to refresh credentials if 403 persists
  3. Reduce polling frequency of the usage endpoint to avoid rate limiting
  4. Confirm the Antigravity service is not in an outage window

Example fix

// before
if (!response.ok) {
  throw new Error(`Antigravity API error: ${response.status}`);
}
// after
if (!response.ok) {
  const body = await response.text().catch(() => "");
  throw new Error(`Antigravity API error: ${response.status} ${body.slice(0, 200)}`);
}
Defensive patterns

Strategy: retry

Validate before calling

// Ensure credentials are fresh before polling quotas
if (!account?.antigravity?.accessToken) return { authExpired: true };

Try / catch

try {
  usage = await getAntigravityUsage(account);
} catch (e) {
  const status = Number(/Antigravity API error: (\d+)/.exec(e.message)?.[1]);
  if (status === 429) { await sleep(60_000); return retry(); }
  if (status === 403) return { reconnect: true };
  throw e;
}

Prevention

When it happens

Trigger: The Antigravity quota endpoint returns 403 (forbidden credential/scope), 429 (rate limited), or 5xx (upstream outage) while getAntigravityUsage is called from USAGE_HANDLERS or the usage route.

Common situations: Refresh token flow produced a valid-but-underprivileged credential; too-frequent quota polling; Google-side outage; region/blocking returning 403.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/4b8ca71b629a1c49. Report an issue: GitHub.