gemini-cli - 💡(How to fix) Fix [Bug]: CLI stalls silently on startup in headless/remote environments (keychain access failure) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25559Fetched 2026-04-17 08:55:09
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Root Cause

When starting the gemini CLI in a headless terminal environment, the application freezes indefinitely without printing any errors, logs, or output. This appears to be caused by the CLI attempting to access the native OS secure keychain, which is unavailable in standard remote workflows.

Fix Action

Fix / Workaround

Workaround: Manually forcing the CLI to bypass the system keychain resolves the freeze:

Code Example

> /about
╭────────────────────────────────────────────────────────────────────────────────╮
│                                                                                │
About Gemini CLI│                                                                                │
CLI Version                0.38.1Git Commit                 7f5580034                                           │
Model                      Auto (Gemini 3)Sandbox                    no sandbox                                          │
OS                         linux                                               │
Auth Method                Signed in with Google (xujj15@gmail.com)Tier                       Gemini Code Assist in Google One AI Pro│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯
RAW_BUFFERClick to expand / collapse

What happened?

When starting the gemini CLI in a headless terminal environment, the application freezes indefinitely without printing any errors, logs, or output. This appears to be caused by the CLI attempting to access the native OS secure keychain, which is unavailable in standard remote workflows.

What did you expect to happen?

It should login normally.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
╭────────────────────────────────────────────────────────────────────────────────╮
│                                                                                │
│ About Gemini CLI                                                               │
│                                                                                │
│ CLI Version                0.38.1                                              │
│ Git Commit                 7f5580034                                           │
│ Model                      Auto (Gemini 3)                                     │
│ Sandbox                    no sandbox                                          │
│ OS                         linux                                               │
│ Auth Method                Signed in with Google ([email protected])            │
│ Tier                       Gemini Code Assist in Google One AI Pro             │
│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯
</details>

Login information

No response

Anything else we need to know?

Workaround: Manually forcing the CLI to bypass the system keychain resolves the freeze:

Bash export GEMINI_FORCE_FILE_STORAGE=true

extent analysis

TL;DR

Setting the GEMINI_FORCE_FILE_STORAGE environment variable to true may resolve the freeze issue when running the gemini CLI in a headless terminal environment.

Guidance

  • The likely cause of the issue is the CLI's attempt to access the native OS secure keychain, which is unavailable in standard remote workflows.
  • To verify, try running the gemini CLI with the GEMINI_FORCE_FILE_STORAGE=true environment variable set and check if the application starts normally.
  • To mitigate the issue, set the GEMINI_FORCE_FILE_STORAGE environment variable to true before running the gemini CLI, as shown in the provided workaround.
  • This workaround may have implications for the application's security and storage mechanisms, so it's essential to understand the trade-offs before implementing it.

Example

export GEMINI_FORCE_FILE_STORAGE=true
gemini

Notes

The provided workaround may not be a permanent solution and might have security implications. It's crucial to investigate the root cause of the issue and consider alternative solutions that balance security and functionality.

Recommendation

Apply the workaround by setting GEMINI_FORCE_FILE_STORAGE=true to resolve the immediate issue, as it is a straightforward and effective solution to the problem described.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING