[BUG] File suggester fails to dismiss after space/newline, causing ENTER to overwrite final word instead of submitting prompt

Status Open
Reported on v2.1.185
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Aug 4, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Reviving #69823

File suggester fails to dismiss after space/newline, causing ENTER to overwrite final word instead of submitting prompt.

When a user references a path using @~/some/path/ (trailing space) and continues typing a prompt , the autocomplete suggestion context fails to dismiss. Because the suggester remains active, pressing ENTER to submit the prompt is instead trapped by the autocomplete handler, which replaces the last typed word of the query with a path completion.

Steps to Reproduce & Behavioral Matrix

Objective: Reference a directory and ask a question (e.g., @~/some/path/ some question).

The input sequence is prefaced with @~/some/path/

| Input Sequence | Input State | Desired State | Actial State (if different) | Desired Behaviour | Current Behaviour |
| :---------------------------------------------------- | :------------------------------ | :-------------------------------------- | :----------------------------------------------- | :------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| ENTER | @~/some/pa | @~/some/path/ | | Completes the path. | ✅ Completes the path, even with spaces such as @~/some/path with spaces/ |
| [Space] | @~/some/path/ | @~/some/path/ | | Dismisses suggester, since paths with spaces don't quite work with the autocomplete anyways. | ❌ Dismisses the suggester. |
| [Space] + ENTER | @~/some/path/ | @~/some/path/ | | Submits the promot. | ❌ Dismisses the suggester, but does not submit the prompt. |
| [Space] + [Any Char/Word] + ENTER | @~/some/path/ a question | @~/some/path/ a question | @~/some/path/ a @~/some/path/__pycache__/ | Submits the prompt. | ❌ Suggester stays active. ENTER overwrites the final word. |
| SHIFT+ENTER (Newline) | @~/some/path/ | @~/some/path/<br>\n (empty newline) | | Dismisses suggester. | ❌ Suggester stays active. |
| SHIFT+ENTER (Newline) + [Any Char/Word] + ENTER | @~/some/path/<br>a question | @~/some/path/<br>a question | @~/some/path/<br>a @~/some/path/__pycache__/ | Dismisses suggester, submits the prompt. | ❌ Suggester stays active across newlines. ENTER overwrites the final word on the new line. |

Current Workaround

To bypass the active state trap, users must manually dismiss the suggester before continuing their query:

  1. Type @/intended/dir/ + (space).
  2. Workaround: Press ENTER (to dismiss).
  3. Type the remainder of the prompt.
  4. Press ENTER again to submit.

Claude Code Version

2.1.185

Terminal/Shell

Observed in, not limited to; kitty, VSCode, konsole, alacritty

Operating System

Ubuntu/Debian Linux

Feedback ID: 7392d4f0-94da-404c-bc80-75f8c611ce14

View original on GitHub ↗

3 Comments

NubeBuster · 23 days ago

Bump

bcherny collaborator · 15 days ago

Reproduced on v2.1.233 (macOS).

Steps:

  1. Start claude in any project.
  2. Type @~/.local/share/claude/versi (any ~/-, /- or ./-prefixed directory path works) and press Enter to accept the completion. Input becomes @~/.local/share/claude/versions/ and the dropdown re-opens listing that directory's children.
  3. Type a question (space, then words).
  4. Press Enter.

Observed: the dropdown stays open after the space and after further typing. Enter does not submit; instead the last word is replaced with the highlighted entry:

❯ @~/.local/share/claude/versions/ a @~/.local/share/claude/versions/2.1.207

Expected: typing a space (or newline) after a completed directory path dismisses the dropdown, and Enter submits the prompt.

Note: this only happens with directory-style paths (@~/..., @/..., @./...). With a plain relative path like @mydir/, the dropdown closes on space and Enter submits normally.

Assessment: this looks like a genuine bug, not intended behavior. Path-style @ completions use a separate directory-browsing dropdown, and that dropdown is never cleared once you move past the path with a space or newline, so it keeps capturing Enter. Plain @file completions already dismiss correctly in the same situation, and the same dropdown is deliberately dismissed in other contexts specifically to avoid hijacking Enter — the @~/, @/, @./ case is simply missing that handling. This is long-standing (same behavior as #69823), not a recent regression. Fix should be straightforward: dismiss the directory dropdown when the cursor is no longer inside a path-style @ token.

🤖 Generated with Claude Code

bcherny collaborator · 6 days ago

Reproduced on the current release (2.1.233) on Linux, exactly per your behavioral matrix: with @~/some/dir/ typed and the suggester open, typing a space plus further words leaves the suggester active, and pressing ENTER replaces the final typed word with the highlighted path completion (including the __pycache__ case) instead of submitting the prompt.

One narrowing detail from the reproduction that may help: the failure appears specific to ~/-prefixed paths. The identical sequence with a relative path (@subdir/ + space + words + ENTER) behaves correctly — the suggester dismisses at the space and ENTER submits. So the stuck-active state seems tied to how home-relative @ mentions are tokenized rather than to the suggester in general.

Your workaround (press ENTER once after the trailing space to dismiss, then continue typing) also works in our testing. Marking this as a confirmed bug.

🤖 Generated with Claude Code