[BUG] @ file autocomplete Enter key submits message instead of accepting suggestion when image is pasted
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?
When an image has been pasted into the input field, using the @ file path autocomplete and pressing Enter to accept a suggestion submits the entire message instead of completing the file path. Without an image present, Enter correctly accepts the autocomplete suggestion as expected.
What Should Happen?
Pressing Enter while the @ file autocomplete dropdown is active should always accept the selected suggestion, regardless of whether an image has been pasted into the input.
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code session
- Paste an image into the input (e.g., screenshot via Ctrl+V)
- Type @ followed by the beginning of a file name
- Observe the autocomplete dropdown appears with file suggestions
- Press Enter to accept a suggestion
- The message is submitted instead of the file path being completed
Without image (works correctly):
- Type @ followed by the beginning of a file name
- Press Enter to accept a suggestion
- The file path is correctly inserted into the input
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
4.5
Claude Code Version
2.1.39 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Related issues involving autocomplete and image paste conflicts:
#18106 — Ghost text submitted along with pasted image/file path
#20439 — Autocomplete suggestion submitted when pasting image + Enter (closed as duplicate of #18106)
This appears to be a separate manifestation of the same general problem area: the TUI's Enter key routing doesn't properly prioritize autocomplete acceptance over message submission when an image is present in the input buffer.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗