decolua/9router · error · Error

No project ID found in response

Error message

No project ID found in response

What it means

GeminiCLIService.fetchProjectId() (src/lib/oauth/services/gemini.js:99) treats the loadCodeAssist response as successful only if it can extract a non-empty cloudaicompanionProject — either a plain string or an object with an .id. When the 2xx response contains neither (or an empty/whitespace string), the library throws, because saving tokens without a project ID would leave the Gemini CLI provider unusable.

Source

Thrown at src/lib/oauth/services/gemini.js:99

    );

    if (!response.ok) {
      const error = await response.text();
      throw new Error(`Failed to fetch project ID: ${error}`);
    }

    const data = await response.json();

    // Extract project ID
    let projectId = "";
    if (typeof data.cloudaicompanionProject === "string") {
      projectId = data.cloudaicompanionProject.trim();
    } else if (data.cloudaicompanionProject?.id) {
      projectId = data.cloudaicompanionProject.id.trim();
    }

    if (!projectId) {
      throw new Error("No project ID found in response");
    }

    return projectId;
  }

  /**
   * Get user info from Google
   */
  async getUserInfo(accessToken) {
    const response = await fetch(`${this.config.userInfoUrl}?alt=json`, {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        Accept: "application/json",
      },
    });

    if (!response.ok) {
      const error = await response.text();

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Log the full response JSON from loadCodeAssist to see what fields are actually returned.
  2. Ensure the Google account has Gemini Code Assist enabled/onboarded (visit the Code Assist onboarding in AI Studio / Cloud Console) and retry.
  3. Try authorizing with a personal (non-Workspace) Google account, which auto-provisions a project more reliably.
  4. If data shows a new schema (e.g. project under a different key), update the extraction logic in fetchProjectId.
  5. Wait and retry — auto-provisioning can lag minutes behind first consent.

Example fix

// before
if (!projectId) {
  throw new Error("No project ID found in response");
}
// after
if (!projectId) {
  const tier = data.currentTier || data.allowedTiers;
  throw new Error(`No project ID in loadCodeAssist response (tier=${JSON.stringify(tier)}). Onboard the account to Gemini Code Assist, then re-run connect().`);
}
Defensive patterns

Strategy: validation

Validate before calling

// shape-check the loadCodeAssist payload before relying on it
const data = await response.json();
const proj = data.cloudaicompanionProject;
const ok = typeof proj === "string" ? proj.trim().length > 0 : !!(proj && typeof proj.id === "string" && proj.id.trim());
if (!ok) console.error("No cloudaicompanionProject in response; account may not be onboarded to Code Assist.", JSON.stringify(data).slice(0, 500));

Type guard

function extractProjectId(data) {
  const p = data?.cloudaicompanionProject;
  if (typeof p === "string" && p.trim()) return p.trim();
  if (p && typeof p.id === "string" && p.id.trim()) return p.id.trim();
  return null;
}

Try / catch

try {
  const projectId = await geminiService.fetchProjectId(tokens.access_token);
} catch (err) {
  if (err.message === "No project ID found in response") {
    console.error("Your Google account has no Code Assist project yet. Onboard at the Gemini Code Assist console, or retry with a personal account.");
  } else throw err;
}

Prevention

When it happens

Trigger: fetchProjectId(accessToken) returns 200 but data.cloudaicompanionProject is undefined, empty string, or whitespace-only — e.g. the account has never provisioned a Code Assist project, the API returned a tier/onboarding-only payload (currentTier with no project), or Google altered the response schema.

Common situations: Brand-new Google accounts with no auto-provisioned cloudaicompanionProject yet; Workspace accounts where admin policy blocks auto-provisioning; users in regions where onboarding is incomplete; the internal API changed shape so the field moved/renamed.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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