kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

Must specify `GOOGLE_CLOUD_PROJECT` for Gemini CLI provider to work — but how?

Open twardoch opened this issue 5 months ago • 7 comments

Description

With Gemini CLI on Kilo Code I get:

Gemini CLI API error: [{
  "error": {
    "code": 403,
    "message": "Permission denied on resource project default.",
    "errors": [
      {
        "message": "Permission denied on resource project default.",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CONSUMER_INVALID",
        "domain": "googleapis.com",
        "metadata": {
          "containerInfo": "default",
          "service": "cloudaicompanion.googleapis.com",
          "consumer": "projects/default"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "Permission denied on resource project default."
      },
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console",
            "url": "https://console.developers.google.com"
          }
        ]
      }
    ]
  }
}
]

Retry attempt 1
Retrying now...

I have a paid Google Code Assist account, and Google CLI in my terminal works only if I provide the GOOGLE_CLOUD_PROJECT env variable (this is described in https://github.com/jarvisphere/gemini-cli/blob/main/docs/cli/authentication.md ).

I have it defined in ~/.gemini/.env and in my general shell.

But with Kilo Code, this does not work. I presume that the GOOGLE_CLOUD_PROJECT env variable is not passed to Gemin CLI.

twardoch avatar Jul 09 '25 16:07 twardoch

This https://github.com/Kilo-Org/kilocode/pull/947 didn’t fully fix it

twardoch avatar Jul 09 '25 16:07 twardoch

Unfortunately I can only double this

matbgn avatar Jul 12 '25 17:07 matbgn

HI,

  • if on WSL try setting on windows where vscode is installed...
  • close +open vscode and try, after env updates

nikhil-swamix avatar Jul 13 '25 19:07 nikhil-swamix

Hi @twardoch, have you tried setting the GOOGLE_CLOUD_PROJECT env variable before starting vscode?

chrarnoldus avatar Jul 15 '25 12:07 chrarnoldus

UPD Looks like it can be put to ~/.gemini/.env: https://github.com/Kilo-Org/kilocode/commit/e8fd6c98543faff8b0bf082cbc73df040989bf97

(Below are older investigations.)

Surprisingly, the geminiCliProjectId setting is there in the code: https://github.com/Kilo-Org/kilocode/blob/86299adde7b49fc6f210d464180aa47c852a3fb8/packages/types/src/provider-settings.ts#L198

However, I cannot see it in the UI (Kilo Code ver. 4.79.0). Though, the commit introducing it should be present in the version.

bryzgaloff avatar Aug 10 '25 23:08 bryzgaloff

You have to use quotation mark in your .env, even though gcloud project id don't contain spaces or special characters.

export GOOGLE_CLOUD_PROJECT="your project id" instead of export GOOGLE_CLOUD_PROJECT=your project id

Yana-Hangabina avatar Aug 19 '25 10:08 Yana-Hangabina

You have to use quotation mark in your .env

Works w/ & w/o.

piknockyou avatar Sep 02 '25 10:09 piknockyou

if I specify the GOOGLE_CLOUD_PROJECT it works, however I have the pro plan and by specifying the project it uses the free quota instead of my pro plan. How to use the pro quota in this case?

alexandrekm avatar Sep 25 '25 18:09 alexandrekm

if I specify the GOOGLE_CLOUD_PROJECT it works, however I have the pro plan and by specifying the project it uses the free quota instead of my pro plan. How to use the pro quota in this case?

Similar question how can i get it working without setting a GOOGLE_CLOUD_PROJECT and like just being able to use the pro/free plan for it?

For more context: So i just upgraded my main google account to use google AI pro and now i suddenly get the above described error when trying to use kilo code with Gemini-CLI but when i delete the Gemini folder then login with my other google account that has no AI pro subscription i can use it with any problems.

ForBai avatar Sep 26 '25 00:09 ForBai

I found out that now google created a secondary project sort of hidden to track the gemini cli quota google console check this you will see a project with an id and no name. This is the one it should be on the env variables.

It works however I am reaching the quota and then when I try gemini cli it works so something is no quite right with the provider or how google tracks it

EDIT: I was wrong about the quotas provider configuration, this approach works perfectly.

alexandrekm avatar Sep 26 '25 17:09 alexandrekm