This guide provides solutions to common issues and debugging tips, including topics on:
Failed to login. Message: Request contains an invalid argument
GOOGLE_CLOUD_PROJECT
to your project ID.UNABLE_TO_GET_ISSUER_CERT_LOCALLY
or unable to get local issuer certificate
NODE_EXTRA_CA_CERTS
environment variable to the absolute path of your corporate root CA certificate file.
export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt
npm
, update it using the command npm install -g @google/gemini-cli@latest
. If you compiled it from source, pull the latest changes from the repository, and then rebuild using the command npm run build
.settings.json
files:
~/.gemini/settings.json
../.gemini/settings.json
.Refer to Gemini CLI Configuration for more details.
/stats
command in Gemini CLI.EADDRINUSE
(Address already in use) when starting an MCP server.
gemini
).
PATH
.gemini
globally, check that your npm
global binary directory is in your PATH
. You can update Gemini CLI using the command npm install -g @google/gemini-cli@latest
.gemini
from source, ensure you are using the correct command to invoke it (e.g., node packages/cli/dist/index.js ...
). To update Gemini CLI, pull the latest changes from the repository, and then rebuild using the command npm run build
.MODULE_NOT_FOUND
or import errors.
npm install
to ensure all dependencies are present.npm run build
to compile the project.npm run start
.CI_
(e.g., CI_TOKEN
) is set. This is because the is-in-ci
package, used by the underlying UI framework, detects these variables and assumes a non-interactive CI environment.is-in-ci
package checks for the presence of CI
, CONTINUOUS_INTEGRATION
, or any environment variable with a CI_
prefix. When any of these are found, it signals that the environment is non-interactive, which prevents the Gemini CLI from starting in its interactive mode.CI_
prefixed variable is not needed for the CLI to function, you can temporarily unset it for the command. e.g., env -u CI_TOKEN gemini
DEBUG=true
in a project’s .env
file doesn’t enable debug mode for gemini-cli.DEBUG
and DEBUG_MODE
variables are automatically excluded from project .env
files to prevent interference with gemini-cli behavior..gemini/.env
file instead, or configure the advanced.excludedEnvVars
setting in your settings.json
to exclude fewer variables.The Gemini CLI uses specific exit codes to indicate the reason for termination. This is especially useful for scripting and automation.
Exit Code | Error Type | Description |
---|---|---|
41 | FatalAuthenticationError |
An error occurred during the authentication process. |
42 | FatalInputError |
Invalid or missing input was provided to the CLI. (non-interactive mode only) |
44 | FatalSandboxError |
An error occurred with the sandboxing environment (e.g., Docker, Podman, or Seatbelt). |
52 | FatalConfigError |
A configuration file (settings.json ) is invalid or contains errors. |
53 | FatalTurnLimitedError |
The maximum number of conversational turns for the session was reached. (non-interactive mode only) |
--verbose
flag (if available) with CLI commands for more detailed output.node --inspect
) if you need to step through server-side code.run_shell_command
, check that the command works directly in your shell first.npm run preflight
before committing code. This can catch many common issues related to formatting, linting, and type errors.If you encounter an issue that was not covered here in this Troubleshooting guide, consider searching the Gemini CLI Issue tracker on GitHub. If you can’t find an issue similar to yours, consider creating a new GitHub Issue with a detailed description. Pull requests are also welcome!