Skip to content

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

@iblea

Description

@iblea

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

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

gemini_bug.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalityhelp wantedWe will accept PRs from all issues marked as "help wanted". Thanks for your support!priority/p2Important but can be addressed in a future release.type/bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions