Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Gemini CLI error

Gemini CLI: Failed to login. Message: Precondition check failed

Error message
Failed to login. Message: Precondition check failed.

Status: Fixed in releaseLast verified 2 documented fixes4 sources

What it means

Code Assist onboarding rejected the login request, usually because a Google Cloud project was sent for a free-tier login.

Causes

  • Source comment in setup.ts: "The free tier uses a managed google cloud project. Setting a project in the onboardUser request causes a Precondition Failed error."
  • Maintainer (gsquared94, #5331): having GOOGLE_CLOUD_PROJECT set to a project without completed Gemini Code Assist onboarding.

How to fix it

  1. Fix 1.

    Upgrade to v0.1.21 or later. The issue was closed as completed by #6113, "fix: use server-returned project for gca free tier auth".

    Terminal
    npm install -g @google/gemini-cli@latest
  2. Fix 2.

    Maintainer guidance: to use the free experience, unset GOOGLE_CLOUD_PROJECT. To use a project, follow the Gemini Code Assist onboarding instructions (https://cloud.google.com/gemini/docs/discover/set-up-gemini) to enable the necessary APIs and purchase a license.

    Terminal
    unset GOOGLE_CLOUD_PROJECT

More Gemini CLI errors

All 19 Gemini CLI errors

FAQ

What does "Failed to login. Message: Precondition check failed" mean in Gemini CLI?

Code Assist onboarding rejected the login request, usually because a Google Cloud project was sent for a free-tier login.

How do I fix "Failed to login. Message: Precondition check failed"?

There are 2 documented fixes. Start with the first: Upgrade to v0.1.21 or later. The issue was closed as completed by #6113, "fix: use server-returned project for gca free tier auth".

Is this Gemini CLI error fixed?

Status: Fixed in release. A release fixed this. The affected versions note says where the fix landed. Affected versions: Reported on 0.1.15; fixed in v0.1.21 (#6113)

Sources

Last verified against 4 sources: official docs, maintainer replies and release notes.

Newsletter

Fixes for the tools you use, weekly

One email per week. New coding agent releases, what broke, and how developers are working around it.