decolua/9router · error · Error

loadCodeAssist failed: HTTP ${response.status} ${errorText.s

Error message

loadCodeAssist failed: HTTP ${response.status} ${errorText.slice(0, 200)}

What it means

fetchProjectId calls Google's Cloud Code loadCodeAssist endpoint to resolve the real GCP project ID bound to the authenticated account. When the HTTP response is not OK, it throws with the status code plus the first 200 chars of the error body. This means Google rejected the loadCodeAssist call itself, before any project ID could be extracted.

Source

Thrown at open-sse/services/projectId.js:170

 * Falls back to onboardUser when loadCodeAssist returns no project.
 *
 * @param {string}      accessToken
 * @param {AbortSignal} signal
 * @returns {Promise<string|null>}
 */
async function fetchProjectId(accessToken, signal, provider) {
    const endpoints = CLOUD_CODE_API[provider] || CLOUD_CODE_API["gemini-cli"];
    const headers = provider === "antigravity" ? ANTIGRAVITY_LOAD_CODE_ASSIST_HEADERS : LOAD_CODE_ASSIST_HEADERS;
    const response = await fetch(endpoints.loadCodeAssist, {
        method: "POST",
        headers: { ...headers, "Authorization": `Bearer ${accessToken}` },
        body: JSON.stringify({ metadata: LOAD_CODE_ASSIST_METADATA }),
        signal
    });

    if (!response.ok) {
        const errorText = await response.text().catch(() => "");
        throw new Error(`loadCodeAssist failed: HTTP ${response.status} ${errorText.slice(0, 200)}`);
    }

    const data = await response.json();
    const projectId = extractProjectId(data);
    if (projectId) return projectId;

    // Determine the tier to use for onboarding
    let tierID = "legacy-tier";
    if (Array.isArray(data.allowedTiers)) {
        for (const tier of data.allowedTiers) {
            if (tier && typeof tier === "object" && tier.isDefault === true) {
                if (tier.id && typeof tier.id === "string" && tier.id.trim()) {
                    tierID = tier.id.trim();
                    break;
                }
            }
        }
    }

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Refresh the connection's OAuth access token (re-run the token refresh / re-authorize the Gemini/Antigravity account) and retry
  2. Inspect the error body in the message (first 200 chars) for the actual Google error reason (e.g. UNAUTHENTICATED, PERMISSION_DENIED)
  3. Check proxy settings — ensure the request can reach cloudcode-pa.googleapis.com
  4. Retry later on 429/5xx; the fetch is deduplicated and cached for 1 hour, so a retry after the transient issue is cheap

Example fix

// before
const projectId = await fetchProjectId(accessToken, proxyOptions);
// after
let projectId;
try {
  projectId = await fetchProjectId(accessToken, proxyOptions);
} catch (e) {
  if (/HTTP 401|HTTP 403/.test(e.message)) {
    accessToken = await refreshToken(connection);
    projectId = await fetchProjectId(accessToken, proxyOptions);
  } else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// before calling fetchProjectId
if (!accessToken || accessToken.split('.').length !== 3) {
  throw new Error('Gemini connection has no valid access token; re-authorize first.');
}

Type guard

function hasToken(t) { return typeof t === 'string' && t.length > 20 && t.includes('.'); }

Try / catch

try {
  projectId = await fetchProjectId(accessToken, proxyOptions);
} catch (e) {
  if (/HTTP (401|403)/.test(e.message)) {
    accessToken = await refreshToken(conn); // re-auth then retry once
    projectId = await fetchProjectId(accessToken, proxyOptions);
  } else if (/HTTP (429|5\d\d)/.test(e.message)) {
    await backoff(); // retry later
  } else throw e;
}

Prevention

When it happens

Trigger: The POST to the cloudcode-pa.googleapis.com loadCodeAssist endpoint returns a non-2xx status — typically 401/403 from an expired/revoked OAuth access token, 429 from rate limiting, or 5xx from a Google-side outage.

Common situations: Stale OAuth credentials after the account was re-authorized elsewhere; Google Cloud Code API unavailable or region-restricted; proxy misconfiguration routing requests through a blocked egress; account flagged by Google anti-abuse.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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