Skip to content

Commit c402784

Browse files
8bitmp3SandyTao520
andauthored
Fix and improve Gemini CLI troubleshooting.md doc (#2734)
Co-authored-by: Sandy Tao <[email protected]>
1 parent bed6ab1 commit c402784

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

docs/troubleshooting.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
# Troubleshooting Guide
1+
# Troubleshooting guide
22

3-
This guide provides solutions to common issues and debugging tips.
3+
This guide provides solutions to common issues and debugging tips, including topics on:
44

5-
## Authentication
5+
- Authentication or login errors
6+
- Frequently asked questions (FAQs)
7+
- Debugging tips
8+
- Existing GitHub Issues similar to yours or creating new Issues
9+
10+
## Authentication or login errors
611

712
- **Error: `Failed to login. Message: Request contains an invalid argument`**
8-
- Users with Google Workspace accounts, or users with Google Cloud accounts
13+
- Users with Google Workspace accounts or Google Cloud accounts
914
associated with their Gmail accounts may not be able to activate the free
1015
tier of the Google Code Assist plan.
1116
- For Google Cloud accounts, you can work around this by setting
1217
`GOOGLE_CLOUD_PROJECT` to your project ID.
13-
- You can also grab an API key from [AI Studio](https://aistudio.google.com/app/apikey), which also includes a
18+
- Alternatively, you can obtain the Gemini API key from
19+
[Google AI Studio](http://aistudio.google.com/app/apikey), which also includes a
1420
separate free tier.
1521

1622
## Frequently asked questions (FAQs)
1723

1824
- **Q: How do I update Gemini CLI to the latest version?**
19-
- A: If installed globally via npm, update Gemini CLI using the command `npm install -g @google/gemini-cli@latest`. If run from source, pull the latest changes from the repository and rebuild using `npm run build`.
25+
- A: If you installed it globally via `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`.
26+
27+
- **Q: Where are the Gemini CLI configuration or settings files stored?**
28+
- A: The Gemini CLI configuration is stored in two `settings.json` files:
29+
1. In your home directory: `~/.gemini/settings.json`.
30+
2. In your project's root directory: `./.gemini/settings.json`.
2031

21-
- **Q: Where are Gemini CLI configuration files stored?**
22-
- A: The CLI configuration is stored within two `settings.json` files: one in your home directory and one in your project's root directory. In both locations, `settings.json` is found in the `.gemini/` folder. Refer to [CLI Configuration](./cli/configuration.md) for more details.
32+
Refer to [Gemini CLI Configuration](./cli/configuration.md) for more details.
2333

2434
- **Q: Why don't I see cached token counts in my stats output?**
25-
- A: Cached token information is only displayed when cached tokens are being used. This feature is available for API key users (Gemini API key or Vertex AI) but not for OAuth users (Google Personal/Enterprise accounts) at this time, as the Code Assist API does not support cached content creation. You can still view your total token usage with the `/stats` command.
35+
- A: Cached token information is only displayed when cached tokens are being used. This feature is available for API key users (Gemini API key or Google Cloud Vertex AI) but not for OAuth users (such as Google Personal/Enterprise accounts like Google Gmail or Google Workspace, respectively). This is because the Gemini Code Assist API does not support cached content creation. You can still view your total token usage using the `/stats` command in Gemini CLI.
2636

2737
## Common error messages and solutions
2838

@@ -31,26 +41,27 @@ This guide provides solutions to common issues and debugging tips.
3141
- **Solution:**
3242
Either stop the other process that is using the port or configure the MCP server to use a different port.
3343

34-
- **Error: Command not found (when attempting to run Gemini CLI).**
35-
- **Cause:** Gemini CLI is not correctly installed or not in your system's PATH.
44+
- **Error: Command not found (when attempting to run Gemini CLI with `gemini`).**
45+
- **Cause:** Gemini CLI is not correctly installed or it is not in your system's `PATH`.
3646
- **Solution:**
37-
1. Ensure Gemini CLI installation was successful.
38-
2. If installed globally, check that your npm global binary directory is in your PATH.
39-
3. If running from source, ensure you are using the correct command to invoke it (e.g., `node packages/cli/dist/index.js ...`).
47+
The update depends on how you installed Gemini CLI:
48+
- If you installed `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`.
49+
- If you are running `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`.
4050

4151
- **Error: `MODULE_NOT_FOUND` or import errors.**
4252
- **Cause:** Dependencies are not installed correctly, or the project hasn't been built.
4353
- **Solution:**
4454
1. Run `npm install` to ensure all dependencies are present.
4555
2. Run `npm run build` to compile the project.
56+
3. Verify that the build completed successfully with `npm run start`.
4657

4758
- **Error: "Operation not permitted", "Permission denied", or similar.**
48-
- **Cause:** If sandboxing is enabled, then the application is likely attempting an operation restricted by your sandbox, such as writing outside the project directory or system temp directory.
49-
- **Solution:** See [Sandboxing](./cli/configuration.md#sandboxing) for more information, including how to customize your sandbox configuration.
59+
- **Cause:** When sandboxing is enabled, Gemini CLI may attempt operations that are restricted by your sandbox configuration, such as writing outside the project directory or system temp directory.
60+
- **Solution:** Refer to the [Configuration: Sandboxing](./cli/configuration.md#sandboxing) documentation for more information, including how to customize your sandbox configuration.
5061

51-
- **CLI is not interactive in "CI" environments**
52-
- **Issue:** The CLI does not enter interactive mode (no prompt appears) if an environment variable starting with `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.
53-
- **Cause:** The `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 CLI from starting in its interactive mode.
62+
- **Gemini CLI is not running in interactive mode in "CI" environments**
63+
- **Issue:** The Gemini CLI does not enter interactive mode (no prompt appears) if an environment variable starting with `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.
64+
- **Cause:** The `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.
5465
- **Solution:** If the `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`
5566

5667
- **DEBUG mode not working from project .env file**
@@ -72,9 +83,11 @@ This guide provides solutions to common issues and debugging tips.
7283
- **Tool issues:**
7384
- If a specific tool is failing, try to isolate the issue by running the simplest possible version of the command or operation the tool performs.
7485
- For `run_shell_command`, check that the command works directly in your shell first.
75-
- For file system tools, double-check paths and permissions.
86+
- For _file system tools_, verify that paths are correct and check the permissions.
7687

7788
- **Pre-flight checks:**
7889
- Always run `npm run preflight` before committing code. This can catch many common issues related to formatting, linting, and type errors.
7990

80-
If you encounter an issue not covered here, consider searching the project's issue tracker on GitHub or reporting a new issue with detailed information.
91+
## Existing GitHub Issues similar to yours or creating new Issues
92+
93+
If you encounter an issue that was not covered here in this _Troubleshooting guide_, consider searching the Gemini CLI [Issue tracker on GitHub](https://github.com/google-gemini/gemini-cli/issues). 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!

0 commit comments

Comments
 (0)