Failed to sign in. Message:
The message
Failed to sign in. Message:What it means
The sign-in itself may have worked. Gemini CLI prints this when anything in the auth step throws, and the real reason is the text after Message:, which usually comes from Google's servers.
What to do
Read the text after Message:. Workspace and school accounts need GOOGLE_CLOUD_PROJECT set to a project ID; individual accounts usually need it unset. A Gemini API key from AI Studio is the documented way around login problems.
Gemini CLI shows this when the authentication step throws an error, and it always has something stuck on the end:
Failed to sign in. Message: Request contains an invalid argument
Before version 0.34.0 the same line started Failed to login. Message:. A March 2026 change swapped "login" for "sign in" across the CLI, so most of the 135 GitHub issues quoting "Failed to login" (counted September 25, 2026) are the same error on an older build. We read the auth code at the 0.61.0 release, Google's auth and troubleshooting docs in the same repo, and the issues.
The part that matters comes after Message:
The first half is fixed text. The CLI wraps whatever went wrong while it set up your account, and most of the time that's a reply from Google's servers passed through as is. The browser can say "Authentication successful" and you'll still get this, because the failure often comes one step later, when the CLI asks Google's Gemini Code Assist service which plan you're on.
The ways to sign in
Which option you picked in the /auth dialog changes what can go wrong:
- Sign in with Google: a browser sign-in with your Google account (the OAuth flow), with the token cached on your machine. This is the one that fails most.
- Use Gemini API Key: a key from Google AI Studio, read from
GEMINI_API_KEY. No account check happens. - Vertex AI: Google Cloud's paid AI platform, which needs
GOOGLE_CLOUD_PROJECTandGOOGLE_CLOUD_LOCATIONset. - Inside Cloud Shell, or with
GEMINI_CLI_USE_COMPUTE_ADC=trueset on a Google Cloud machine, the dialog adds an option to use that environment's own Google credentials, and it goes through the same account check as Sign in with Google.
When the project ID is the problem
After the browser step, the CLI reads GOOGLE_CLOUD_PROJECT, then GOOGLE_CLOUD_PROJECT_ID. If neither is set and Google doesn't hand back a project for you, you get this line (in 0.61.0 it's shown without the "Failed to sign in" prefix):
This account requires setting the GOOGLE_CLOUD_PROJECT or GOOGLE_CLOUD_PROJECT_ID env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gca
Google's docs list who needs a project: company, school and Workspace accounts, and anyone on a Code Assist license from the Developer Program or a subscription. Set the variable to the project's ID, the text one like my-project-123. The code refuses an all-digit value with a message telling you that's the project number.
The same variable can hurt an individual account. Google's troubleshooting page says a set GOOGLE_CLOUD_PROJECT "forces an organization subscription check", which is how a personal account ends up with a "You must be a named user" message about Code Assist Standard. The fix there is to unset it, including in .env files. Request contains an invalid argument is the other documented one: Workspace accounts and Cloud accounts tied to Gmail can't always activate the free tier, so either set a project or use an API key.
One thing surprised us here. In February an AI Pro subscriber on a personal account got the project-ID message, tried setting the variable three ways with no effect, and another user cleared it by reinstalling, which moved them from 0.29 to 0.30. So update before you start editing your shell profile.
When the network is the problem
Failed to login. Message: Failed to exchange authorization code for tokens: request to https://oauth2.googleapis.com/token failed
This one means the CLI couldn't reach Google's token server after you approved it in the browser. A February report behind a corporate proxy had self-signed certificate in certificate chain on the end, and trusting the proxy's certificate fixed it. The troubleshooting page gives the order: try NODE_USE_SYSTEM_CA=1 first, then point NODE_EXTRA_CA_CERTS at your company's root certificate. On a machine with no browser, NO_BROWSER=true switches to a code you paste by hand.
The Antigravity message
Since June a different reason has been turning up on individual accounts, AI Pro ones included:
This client is no longer supported for Gemini Code Assist for individuals. To continue using Gemini, please migrate to the Antigravity suite of products
The line comes from Google's server rather than the CLI's code (one report shows the reason code UNSUPPORTED_CLIENT), and reinstalling or deleting ~/.gemini didn't change it for the people who tried. Nobody from the Gemini CLI team had replied on any of the eleven issues quoting it when we checked, and the 0.61.0 docs still describe Sign in with Google for personal accounts. A September reporter on 0.59.0 said an API key worked fine, which fits: the key path skips the Code Assist check.
What to try, in order
Update with npm install -g @google/gemini-cli, then run /auth signout to clear the cached credentials and sign in again. Match GOOGLE_CLOUD_PROJECT to your account type as above. If Google login still fails, pick Use Gemini API Key in /auth; it has its own free tier. Workspace users who suddenly see "You do not have a valid license of this product" with nothing changed are in an open August issue, and the message points them at their admin.
Once you're in, running out of requests is a separate error: see “Usage limit reached for all Pro models.”
Other lines the same feature prints
Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.
Failed to login. Message:This account requires setting the GOOGLE_CLOUD_PROJECT or GOOGLE_CLOUD_PROJECT_ID env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gcaFailed to sign in. Message: Request contains an invalid argumentFailed to login. Message: Failed to exchange authorization code for tokens: request to https://oauth2.googleapis.com/token failedThis client is no longer supported for Gemini Code Assist for individuals. To continue using Gemini, please migrate to the Antigravity suite of productsFailed to sign in. Message: You do not have a valid license of this product. Please contact your administrator to request a license.You must be a named user on your organization's Gemini Code Assist Standard edition subscription to use this service.