Heads-up: Setting GOOGLE_CLOUD_PROJECT to a numeric project number causes 400 INVALID_ARGUMENT on all requests #21603
Unanswered
EvilDjango
asked this question in
Q&A
Replies: 1 comment
-
|
From my point of view, this is a very useful finding because the current failure mode is too generic for something that is really just a configuration mismatch. A startup validation that warns when GOOGLE_CLOUD_PROJECT is numeric only would probably save a lot of wasted debugging time. Even a short hint in the error path would make this much easier to diagnose. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Environment
0.32.1oauth-personalSymptom
Every request returns
400 INVALID_ARGUMENTimmediately, regardless of the prompt content:The routing classifier also fails before the main request:
None of the usual remedies worked: downgrading/upgrading CLI, deleting
~/.gemini/and re-authenticating, changing model settings.Root Cause
The environment variable
GOOGLE_CLOUD_PROJECTwas set to the GCP project number (numeric, e.g.623157363865) instead of the project ID (string, e.g.bustling-bay-464713-h7).In
setup.js, the CLI reads this env var first:If the env var is set to the numeric project number, that value gets passed as the
"project"field in all content generation requests to the Code Assist API. The API does not accept numeric project numbers in this field and rejects the request with a generic400error — without any indication of which parameter is wrong or why.In Google Cloud, these are two distinct identifiers for the same project:
623157363865(numeric)bustling-bay-464713-h7(string)Fix
Option A (recommended): Unset
GOOGLE_CLOUD_PROJECTentirely if you're using a personal OAuth account. The CLI will resolve the correct project automatically via the Code Assist API.Option B: If you need the env var set (e.g. for other GCP tools), make sure it points to the string project ID, not the project number.
Find your project ID in Google Cloud Console — it's the hyphenated string under "Project ID", distinct from the numeric "Project Number".
Minor Complaint (not a bug, but worth noting)
The error message
Request contains an invalid argument.gives no hint about which argument is invalid or why. A more targeted message — or even a startup warning whenGOOGLE_CLOUD_PROJECTis set to a numeric-only value — would have saved a lot of debugging time. Worth considering for a future improvement.Related Issues
Beta Was this translation helpful? Give feedback.
All reactions