gemini-cli - 💡(How to fix) Fix ENAMETOOLONG Crash during text input parsing [2 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#26979Fetched 2026-05-14 03:46:03
View on GitHub
Comments
2
Participants
2
Timeline
13
Reactions
0
Timeline (top)
labeled ×6commented ×2added_to_project_v2 ×1issue_type_added ×1

The CLI crashes when pasting long technical text containing slashes or version numbers (e.g., package@14). It appears the input parser mistakenly identifies long strings of prose as local file paths and passes them to lstat.

Error Message

Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS PATH_MAX or contains invalid characters (like quotes/newlines), the process exits with an unhandled ENAMETOOLONG error. This is likely due to a greedy regex (e.g., \/[^\s]+) used for path discovery in user input.

Root Cause

Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS PATH_MAX or contains invalid characters (like quotes/newlines), the process exits with an unhandled ENAMETOOLONG error. This is likely due to a greedy regex (e.g., \/[^\s]+) used for path discovery in user input.

RAW_BUFFERClick to expand / collapse

Description

The CLI crashes when pasting long technical text containing slashes or version numbers (e.g., package@14). It appears the input parser mistakenly identifies long strings of prose as local file paths and passes them to lstat.

Root Cause

Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS PATH_MAX or contains invalid characters (like quotes/newlines), the process exits with an unhandled ENAMETOOLONG error. This is likely due to a greedy regex (e.g., \/[^\s]+) used for path discovery in user input.

Reproduction

Paste a 300+ character paragraph containing a directory-like string (e.g., /my-repo/) followed by a long block of text without spaces.

Example Trigger

The crash was triggered by the following string: .../my-bootstrap-scripts/14", restart_service....

Expected Behavior

The CLI should fail gracefully if a potential path is invalid or too long, instead of crashing with a stack trace.

Environment

  • OS: darwin (macOS)
  • Version: 0.41.2 (as identified from system paths)

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

gemini-cli - 💡(How to fix) Fix ENAMETOOLONG Crash during text input parsing [2 comments, 2 participants]