fix(core): reject numeric project IDs in GOOGLE_CLOUD_PROJECT (#24695)#26532
fix(core): reject numeric project IDs in GOOGLE_CLOUD_PROJECT (#24695)#26532Abhijit-2592 merged 2 commits intomainfrom
Conversation
Setting the `GOOGLE_CLOUD_PROJECT` environment variable to a numeric Project Number instead of a string Project ID caused the Gemini API to fail with a generic `INVALID_ARGUMENT` error. This adds a validation check during setup that throws a clear `InvalidNumericProjectIdError` when a numeric-only project ID is provided, guiding users to use their string-based Project ID.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the developer experience by proactively validating project ID configurations. By preventing the use of numeric project numbers where string-based project IDs are required, it avoids confusing API failures and provides actionable feedback to the user during the setup process. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Size Change: +599 B (0%) Total Size: 34 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a validation check for the Google Cloud Project ID within the setupUser function. It adds a new InvalidNumericProjectIdError class that is triggered when a numeric Project ID is provided instead of the required string-based ID. Additionally, a unit test has been included to verify this new error handling. I have no feedback to provide as there were no review comments.
Summary
This PR adds validation to reject numeric-only project IDs in the
GOOGLE_CLOUD_PROJECT(andGOOGLE_CLOUD_PROJECT_ID) environment variables.Details
Setting a numeric Project Number instead of a string-based Project ID caused the Gemini API to fail with a generic
400 INVALID_ARGUMENTerror. This change introduces anInvalidNumericProjectIdErrorthat is thrown early during setup, providing clear guidance to the user on how to fix their configuration.Related Issues
Fixes #24695
How to Validate
GOOGLE_CLOUD_PROJECTto a numeric value (e.g.,export GOOGLE_CLOUD_PROJECT=123456789).gemini help).npm test -w @google/gemini-cli-core -- src/code_assist/setup.test.tsPre-Merge Checklist