Skip to content

Conversation

@marcus-v-rodrigues
Copy link

Context

Fixes #2838

This PR resolves a 403 PERMISSION_DENIED error for Gemini CLI users who are authenticated with a personal Google (OAuth) account (i.e., not using a GCP project).

The root cause was that the discoverProjectId function in src/api/providers/gemini-cli.ts was incorrectly falling back to a project ID of "default", which is invalid and promptly rejected by the Google API.

Implementation

The implementation is a one-line change in src/api/providers/gemini-cli.ts.

I modified the initialProjectId variable assignment to use an empty string ("") as the fallback instead of "default".

  • Before:

    const initialProjectId = process.env.GOOGLE_CLOUD_PROJECT ?? "default";
  • After:

    const initialProjectId = process.env.GOOGLE_CLOUD_PROJECT ?? "";

Using an empty string correctly signals to the Google API to use the project-less personal authentication flow. This fixes the error without breaking the TypeScript type contract or requiring any other refactoring.

How to Test

This test requires authenticating with the Gemini CLI using the personal "Login with Google" (OAuth) method.

Prerequisite: Ensure you are not authenticated with a GCP project.

  1. Make sure your GOOGLE_CLOUD_PROJECT environment variable is unset.
  2. If you have a ~/.gemini/.env file, ensure it does not contain GOOGLE_CLOUD_PROJECT.
  3. Log in to Kilo Code using the Gemini CLI (personal auth) flow if you haven't already.

To see the bug (on main branch):

  1. Try to use a Gemini CLI feature (e.g., open the chat panel and ask a question).
  2. Observe the 403 PERMISSION_DENIED error notification.

To test the fix (on this PR branch):

  1. Check out this branch (fix/gemini-cli-default-project).
  2. Run the extension (Press F5).
  3. In the new VS Code window, try the same Gemini CLI feature (e.g., open the chat panel and ask a question).
  4. Expected Result: The command now executes successfully, and you receive a response from Gemini.

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: 4a05694

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GEMINI CLI error

1 participant