[BUG] slash command auto-complete is broken (highlighted command doesn't match what I'm typing)
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?
I open a vanilla terminal on a MacBook Pro OSX 15.6.1
I start typing /context but the auto-complete jumps to "/compact"
I fully type out /context and press Enter but it runs the /compact command!
Screenshots:
<img width="396" height="94" alt="Image" src="https://github.com/user-attachments/assets/60610097-121a-44a0-97ac-5e6233e448b8" /> <br />
<img width="418" height="104" alt="Image" src="https://github.com/user-attachments/assets/b2e0d1af-2ce0-4f46-bdf7-a1eb506d68c2" /> <br />
<img width="535" height="114" alt="Image" src="https://github.com/user-attachments/assets/abab1c51-60d8-40b6-a023-f26c7bf0c936" /> <br />
<img width="502" height="159" alt="Image" src="https://github.com/user-attachments/assets/65bbac65-7a46-48dc-a0ae-50eeadd8eb65" /> <br />
<img width="489" height="137" alt="Image" src="https://github.com/user-attachments/assets/adb47dd9-1336-4169-9948-a507ad1cb648" /> <br />
If I press Enter at the end here, it runs /compact instead of /context
If I press Esc instead, it finally switches the autocomplete to /context:
<img width="440" height="147" alt="Image" src="https://github.com/user-attachments/assets/877df571-2f69-415d-a148-8d6eead2dbce" />
What Should Happen?
After I type /con the autocomplete should jump to /context
Error Messages/Logs
Steps to Reproduce
Start typing /context
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.1.12
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
Showing cached comments. Read the full discussion on GitHub ↗
12 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Same with /clear 🗡️
<img width="874" height="542" alt="Image" src="https://github.com/user-attachments/assets/3b745cb5-b634-4289-9a17-e01f7492d478" />
Is Anthropic testing stuff before releasing updates? I hate to ask, but it appears that way.
I am also experiencing this and it is very annoying. /clear matches /compact for me.
Also experiencing this on Linux (v2.1.12). Typing
/clearand pressing Tab autocompletes to/compactinstead. Tested in both VSCode integrated terminal and standalone terminal - same behavior.Experiencing on Windows as well
Fixed in 2.1.14.
This is not fixed, still facing it in 2.1.19 - https://github.com/anthropics/claude-code/issues/20537#issuecomment-3793938882
I suspect that an increase in the number of installed slash commands might have something to do with it.
FYI, but this workaround for a different issue also fixes this issue.
https://github.com/anthropics/claude-code/issues/22103#issuecomment-3828430196
I had a similar issue and found the root cause: one of my skill files was not UTF-8 encoded. After deleting that specific skill file, the autocomplete/fuzzy matching started working correctly.
You might want to check if any of your skill files have encoding issues.
Just had similar issue.
descriptionfield was formatted with newline as this:Removed new line and autocomplete started working again. Also this skill didn't show up in "/skills" command in
opencodebefore I fixed thedescriptionfield.Adding a real-world example of how this bug causes data loss.
My case: typed
/co, the menu highlighted/context, pressed down arrow to "select" it — but the arrow moved the selection to/clear, which executed and silently wiped my entire conversation with no confirmation prompt.The autocomplete bug is the root cause, but I'd also suggest a complementary fix:
/clearshould require a confirmation prompt (e.g."This will erase your conversation history. Continue? [y/N]"). It's the only irreversible command in the CLI, and a confirmation would act as a safety net regardless of how the wrong command gets triggered — accidental arrow key, muscle memory, or any future autocomplete regression.