[BUG] Phantom file attachment in VS Code extension input bar — cannot remove, file not open
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?
Bug: Phantom file attachment in VS Code extension input bar — cannot remove, file not open
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
A file reference (in my case SETUP-GUIDE.md) appears as an attachment chip in the VS Code extension input bar even though:
- The file is not open in any editor tab
- The file is not part of the current task or conversation
- The file was referenced in a previous interaction, not the current one
The attachment persists across messages, meaning it gets sent as context with every turn — silently consuming tokens for no reason.
There is no way to remove it:
- No X/close button on the attachment chip
- Right-clicking offers no remove/detach option
- Backspace/Delete does not remove it
- Clicking the chip does not offer removal
- Ctrl+A and delete in the input bar does not clear it
Expected Behavior
File attachments in the input bar should:
- Have a visible X button or right-click → Remove option
- Not persist from previous interactions into new messages
- Not appear when the referenced file is not open
Impact
This silently wastes context window tokens on every message. For users on Max plans managing context carefully (compacting at 75%, monitoring via /context), a phantom attachment undermines all of that optimization.
Environment
- VS Code with Claude Code extension
- Windows (Git Bash)
- Claude Max subscription
What Should Happen?
What Should Happen?
When a file is referenced or attached in the Claude Code VS Code extension input bar:
A visible X/close button should appear on the attachment chip to allow removal at any time
File references should only persist for the current message — not carry over into subsequent messages automatically
If a file reference does carry over, the user should be able to remove it before sending
Files that are not open in any editor tab and were not explicitly attached by the user should never appear as attachments
When a session is compacted or a new conversation starts, all previous file attachments should be cleared from the input bar
Error Messages/Logs
Steps to Reproduce
<img width="399" height="79" alt="Image" src="https://github.com/user-attachments/assets/70196e96-26d0-41af-85e1-95a0c22937ab" />
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.75
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗