gemini-cli - 💡(How to fix) Fix CLI Crash and Infinite Error Loop on Large Text Paste [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#26491Fetched 2026-05-06 06:36:16
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×1labeled ×1

Error Message

The Gemini CLI fails when a user pastes text longer than approximately 2,000 characters. Instead of processing the prompt, the CLI enters an infinite loop of error-checking or becomes completely unresponsive. This suggests a regression in the input buffer handling or a breakdown in the character-counting logic before the API call is even made. The cli will crash and stack into the loop of self error check. CPU Usage: During the infinite loop, CPU usage for the process spikes, indicating a "busy-wait" or recursive error-handling state. The application enters a "Check Error" loop that prevents any further interaction and requires a SIGINT (Ctrl+C) or SIGKILL to terminate.

Code Example

> /about
CLI Version                                                                0.40.1Git Commit                                                                 7a382e066                                                                                                                                    │
Model                                                                      Auto (Gemini 3)Sandbox                                                                    no sandbox                                                                                                                                   │
OS                                                                         win32                                                                                                                                        │
Auth Method                                                                Signed in with Google (tzhcheung@gmail.com)Tier                                                                       Gemini Code Assist in Google One AI Pro
RAW_BUFFERClick to expand / collapse

What happened?

The Gemini CLI fails when a user pastes text longer than approximately 2,000 characters. Instead of processing the prompt, the CLI enters an infinite loop of error-checking or becomes completely unresponsive. This suggests a regression in the input buffer handling or a breakdown in the character-counting logic before the API call is even made.

What did you expect to happen?

The cli will crash and stack into the loop of self error check.

Client information

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

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

> /about
CLI Version                                                                0.40.1                                                                                                                                       │
│ Git Commit                                                                 7a382e066                                                                                                                                    │
│ Model                                                                      Auto (Gemini 3)                                                                                                                              │
│ Sandbox                                                                    no sandbox                                                                                                                                   │
│ OS                                                                         win32                                                                                                                                        │
│ Auth Method                                                                Signed in with Google ([email protected])                                                                                                  │
│ Tier                                                                       Gemini Code Assist in Google One AI Pro
</details>

Login information

google account

Anything else we need to know?

Technical Observations Character Threshold: The crash consistently occurs right around the 2,000-character mark.

Input Method: This appears specifically tied to pasting (bulk input) rather than typing, suggesting the CLI cannot handle the rapid influx of data into the stdin buffer.

CPU Usage: During the infinite loop, CPU usage for the process spikes, indicating a "busy-wait" or recursive error-handling state.

Expected Behavior The CLI should support inputs up to the model's full context window (e.g., 32k+ tokens). At a minimum, a 2,000-character string should be handled instantaneously without overhead.

Actual Behavior The application enters a "Check Error" loop that prevents any further interaction and requires a SIGINT (Ctrl+C) or SIGKILL to terminate.

extent analysis

TL;DR

The Gemini CLI likely needs an update to its input buffer handling to prevent infinite loops when pasting text longer than 2,000 characters.

Guidance

  • Investigate the character-counting logic and input buffer handling in the Gemini CLI to identify the root cause of the regression.
  • Verify that the issue is specific to pasting text and not typing, as this may indicate a problem with handling rapid input.
  • Check the CLI's configuration and settings to see if there are any limits or thresholds set for input length that could be contributing to the issue.
  • Consider implementing a temporary workaround, such as limiting the input length or adding a delay between input chunks, to prevent the infinite loop.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The issue may be specific to the Windows operating system (win32) and the Gemini Code Assist in Google One AI Pro tier, so any fixes or workarounds may need to be tailored to these environments.

Recommendation

Apply a workaround, such as limiting the input length or adding a delay between input chunks, to prevent the infinite loop, as the root cause of the issue is not yet fully understood and an update to the Gemini CLI may not be immediately available.

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