[BUG] Calude Code (VSCode extension) not honoring .claudeignore file, and not catching that it should have, causing too much token consumption
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 modified my .claudeignore file to ensure Claude's grep expressions are only looking in my /src code, and some other very specific files/folders, with the goal of reducing excessive token usage. However, Claude didn't ignore the files as requested - it read and modified my build outputs directly. Worse of all is that Claude itself didn't catch it. When I pointed it out, it said to open a bug report.
What Should Happen?
My build outputs, and those files specified in .claudeignore to be ignored, should not be read nor modified.
Error Messages/Logs
Is my .claudeignore file not working? You are not supposed to use /DataLaVista.html in your grep's, only the /src files, the build scripts, and the specific files I allowed you to access. DataLaVista*.html are all outputs from the build process.
# Ignore everything in root
/*
# Re-allow .claudeignore itself
!.claudeignore
# Re-allow src and essential files
!/src/**
!/README.md
!/jsconfig.json
!/index.html
!/build.*
!/styles/**
!.github/**
!.claude/**
You're right, and I apologize — I shouldn't have touched [_***_].html. The .claudeignore syntax looks correct to me, so this may be a bug in how Claude Code honors it. I'll revert my edit to [_***_.html](vscode-webview://[_***_]&swVersion=4&extensionId=Anthropic.claude-code&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&session=[_***_]#) now.
[_***_]
Removed 1 line
Click to expand
Reverted. The only correct change is in [_***_] — the build process will propagate it to the HTML outputs.
Regarding .claudeignore: the syntax looks correct to me. /* + selective ! re-allows should exclude the root HTML files. **I'd suggest reporting this as a bug at https://github.com/anthropics/claude-code/issues — the tool honored a Read on an ignored file and I didn't catch that I should have refused.**
Steps to Reproduce
Is my .claudeignore file not working? You are not supposed to use /DataLaVista.html in your grep's, only the /src files, the build scripts, and the specific files I allowed you to access. DataLaVista*.html are all outputs from the build process.
# Ignore everything in root
/*
# Re-allow .claudeignore itself
!.claudeignore
# Re-allow src and essential files
!/src/**
!/README.md
!/jsconfig.json
!/index.html
!/build.*
!/styles/**
!.github/**
!.claude/**
You're right, and I apologize — I shouldn't have touched [__].html. The .claudeignore syntax looks correct to me, so this may be a bug in how Claude Code honors it. I'll revert my edit to [__.html](vscode-webview://[__]&swVersion=4&extensionId=Anthropic.claude-code&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&session=[__]#) now.
[_***_]
Removed 1 line
Click to expand
Reverted. The only correct change is in [_***_] — the build process will propagate it to the HTML outputs.
Regarding .claudeignore: the syntax looks correct to me. /* + selective ! re-allows should exclude the root HTML files. I'd suggest reporting this as a bug at https://github.com/anthropics/claude-code/issues — the tool honored a Read on an ignored file and I didn't catch that I should have refused.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.88 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Please note: although similar bugs have been reported and have gone unadressed for weeks, this one report is unique in that it directly impacts token consumption, adding to the ongoing problem of Claude Code using way, way more tokens than it should. (https://github.com/anthropics/claude-code/issues/38335 and https://old.reddit.com/r/Anthropic/comments/1s7zfap/investigating_usage_limits_hitting_faster_than/)
#38335
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗