google-gemini/gemini-cli

CLI hangs/freezes when using `@filename:line` or `@filename:range` syntax

Open

#19985 opened on Feb 23, 2026

View on GitHub
 (15 comments) (0 reactions) (1 assignee)TypeScript (103,992 stars) (13,657 forks)batch import
area/coreeffort/smallhelp wantedkind/bugpriority/p1priority/p2status/bot-triagedstatus/need-retestingtype/bug

Description

What happened?

When attempting to reference a specific line or range of a file using the syntax @filename:line (e.g., @app.js:10) or @filename:start-end (e.g., @app.js:10-20), the CLI becomes unresponsive (hangs) and requires a force quit.

It seems the CLI might be trying to resolve the entire string (including the colon and numbers) as a file path, or it gets stuck in an infinite loop trying to parse the syntax.

Steps to Reproduce:

  1. Start gemini-cli.
  2. Type a prompt including a file reference with line numbers.
    • Example: Explain this function @src/main.js:15-25, @src/main.js#L10-#L25, @src/main.js:10 or @src/main.js#L10.
  3. Press Enter.
  4. The CLI freezes (cursor might blink, but no output or response occurs, and input is blocked).
  5. Ctrl+C often fails to interrupt the process immediately.

What did you expect to happen?

  • Ideal: The CLI should read only the specified lines of the file, similar to other AI CLI tools (e.g., Claude Code). I initially thought range reading was supported, but later realized it is not.
  • Fallback: If this syntax is not supported, it should return a clear error message (e.g., "File not found" or "Line number syntax not supported") instead of hanging indefinitely.

Client information

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

> /about
About Gemini CLI
CLI Version                                                      0.29.5
Git Commit                                                       2ef872e73
Model                                                            gemini-3-pro-preview
Sandbox                                                          no sandbox
OS                                                               darwin
Auth Method                                                      Logged in with Google
Tier                                                             Gemini Code Assist in Google One AI Pro

Login information

Google Account

Anything else we need to know?

I noticed this syntax (@filename:line) works seamlessly in other AI CLI tools (like Claude Code), which led to the confusion. If this feature is not supported in gemini-cli, a graceful failure with an informative error message would be much better than a freeze. This issue significantly disrupts the workflow as it forces a restart of the CLI session.

Vedio

https://github.com/user-attachments/assets/1fb2d5ab-d16a-4020-9e2b-aa3644086a4f

Contributor guide