
If your Claude Code @ file mention is not working, the file is usually being hidden, not lost. The @ picker leaves out files that match your .gitignore by default, it only searches your project folder by name, and pressing Tab can grab a folder instead of the file you wanted.
The fastest fix is to type the full path yourself, such as @build/output.log, and send the message. In our test that worked even for a gitignored file the picker refused to suggest. If you want ignored files back in the list, set "respectGitignore": false in a settings file.
If the file shows up but Claude still says it can’t read it, look for a Read deny rule in your permissions, a file over 256KB, or the CLAUDE_CODE_DISABLE_FILE_MENTIONS variable. This guide walks through each cause with real screenshots and the fix that worked.
Browse all our Claude Code tutorials for more fixes and how-tos.
Tested with Claude Code v2.1.332 on macOS on December 4, 2026. We used a small throwaway demo project with a few files, a .gitignore and a second folder next to it, so nothing in a real project or our own setup changed. Items marked as coming from the docs follow Anthropic’s official documentation.
Quick Summary: Why Claude Code @ File Mentions Fail
Find your symptom in the first column. The rows marked “Tested” are things we reproduced in v2.1.332.
| What you see | Likely cause | Fix | How we checked it |
|---|---|---|---|
Typing @outp shows no suggestions | The file is gitignored | Type the full path, or set respectGitignore to false | Tested |
| A file in a sibling folder never appears | The picker searches your project, not other folders | Start with ../ or an absolute path | Tested |
| Claude lists a folder instead of reading the file | Tab accepted a folder like src/utils/ | Keep typing until the file name is complete | Tested |
| Claude says it can’t read the file | A Read deny rule matches it | Edit permissions.deny if the rule is wrong | Tested |
| A big file is not included | Text files over 256KB aren’t attached | Ask Claude to read part of it with its tools | From the official docs |
| Your custom picker command is ignored | A settings gate turned off fileSuggestion | Check disableAllHooks, trust and --safe-mode | From the official docs |
| @ paths reach Claude, but no contents | CLAUDE_CODE_DISABLE_FILE_MENTIONS=1 is set | Unset the variable | From the official docs |
How @ File Mentions Work in Claude Code
The @ key does two separate jobs. First, the picker suggests paths while you type. Second, when you send the message, Claude Code attaches what the path points to: the text of a file, or a listing of a folder.
The official reference guide says a mentioned file is included when it fits the Read tool’s limit of 25,000 tokens by default, and a text file larger than 256KB isn’t included. A mention also adds any CLAUDE.md files in that file’s folder and its parent folders.

If @ can’t find a file, type the full path first. The picker hides files, but sending a typed path still attaches them.
Keeping these two steps apart is the key to every fix below. A file can be missing from the picker but still attach fine when you type its path. It can also show up in the picker and then get blocked when you send it.

As the screenshot shows, the list isn’t only files. Agents appear too, and the interactive mode docs say that from v2.1.232, typing a letter after @ can also suggest your other live sessions when cross-session messaging is on. If the list feels crowded, type more of the file name to narrow it.
Fix 1: The File Is in .gitignore
This is the most common reason the picker can’t find a file. The respectGitignore setting is true by default, so the picker leaves out anything that matches your .gitignore, like build output, logs and local notes.
In our demo, .gitignore listed build/ and private-notes.txt. Typing @outp to find build/output.log gave no suggestions at all.

One detail surprised us. The very first list you see after typing a bare @ still showed build/ and private-notes.txt. The filter kicked in once we typed part of a name, which is how most people search.
Option A: Type the full path
You don’t need the picker to mention a file. Type the whole path, press Esc if a suggestion list is open, and send. Claude Code attached the ignored log without any change to settings.

Option B: Show gitignored files in the picker
If you often need ignored files, turn the filter off. Add this to .claude/settings.local.json for one project, or to ~/.claude/settings.json for every project:
{
"respectGitignore": false
}After a restart, the same @outp search found the log right away. Our guide to settings file examples shows where each settings file lives.

The respectGitignore reference adds that the same switch is in /config as “Respect .gitignore in file picker”. When no settings file sets it, Claude Code falls back to the value that toggle writes to ~/.claude.json.

Fix 2: The File Is Outside Your Project
The picker searches the folder you started Claude Code in. A file in a sibling folder, like a shared style guide, won’t come up when you type its name.
The docs say file paths can be relative or absolute, so start the path with ../ or /. In our test, typing @../at-file-mentions-shared/ made the picker list the folders inside it.

What /add-dir does and doesn’t do
The /add-dir command adds a folder as a working directory, so Claude can read and edit files there. Claude Code first asks whether you trust the folder, then whether to add it for this session or remember it.
Adding the folder did not make its files show up by name in the picker in our test. After /add-dir ../at-file-mentions-shared succeeded, typing @style still found nothing. Use the ../ path for the mention, and use /add-dir when Claude also needs to work in that folder.

Fix 3: Tab Picked a Folder, Not the File
This one looks like a bug but isn’t. We typed @src/ut and pressed Tab, and the picker filled in the highlighted entry, which was the src/utils/ folder.
The docs say directory references show file listings, not contents. Claude Code showed “Listed directory src/utils/” instead of reading the file. Claude still worked out what was in the folder, but in a real project it may have to read files with extra tool calls.

To fix it, keep typing after the folder is filled in. Add the file name, like format.js, and press Tab again on the file. Check the path in your prompt before you press Enter.

Fix 4: A Permission Rule Blocks the File
Sometimes the path is right and the file still never reaches Claude. A Read deny rule is the usual reason, and that is by design. The docs say Claude Code doesn’t include a file that a deny rule matches.
We added this rule to the demo’s .claude/settings.json and then sent @private-notes.txt what does this file say?:
{
"permissions": {
"deny": ["Read(./private-notes.txt)"]
}
}
One small warning from our run: Claude’s reply named the wrong settings file as the source of the rule. Check every settings file yourself instead of trusting the guess. Our permissions guide explains how allow, ask and deny rules combine across files.
If the rule is wrong, remove it or narrow its pattern. If the rule is right, leave it alone. It is doing its job.
More Causes: Big Files, Custom Pickers and Disabled Mentions
We didn’t reproduce the next three causes in our demo. They come from the official documentation, so you can check them against your own setup.
The file is too large
According to the docs, a mentioned file is included when it fits the Read tool’s limit, which is 25,000 tokens by default. A text file larger than 256KB isn’t included. For huge logs or data files, ask Claude to search or read a part of the file instead, which also keeps your context window free for real work.
Your custom fileSuggestion command doesn’t run
Large repos can swap the built-in search for their own command with the fileSuggestion setting. The command gets the typed query as JSON, prints matching paths, and Claude Code shows at most 15 of them. It stops waiting after five seconds.
{
"fileSuggestion": {
"type": "command",
"command": "~/.claude/file-suggestion.sh"
}
}The docs list gates that switch it off. It is off entirely when managed settings set disableAllHooks or the folder isn’t trusted.
It narrows to managed settings when allowManagedHooksOnly is set, when disableAllHooks is true in your own settings, or when you start with --safe-mode. In those cases @ falls back to the built-in search without a warning.
File mentions are turned off
Setting CLAUDE_CODE_DISABLE_FILE_MENTIONS=1 stops Claude Code from expanding @ mentions. Claude gets the paths with a note to read them using its tools. It needs v2.1.299 or later, and Claude Code ignores it in project and local settings, so look in your shell profile, user settings and managed settings.
Real Examples From Our Test
Here are the exact prompts we sent and what Claude Code did with each one. Only four short prompts went to the model; everything else was typing in the picker.
| What we typed | What happened | Lesson |
|---|---|---|
@outp | No suggestions | Gitignored files are hidden by default |
@build/output.log what does this log say? | Read the file and answered | A typed path still works |
@src/ut then Tab | Attached the src/utils/ listing | Check the path before sending |
@../at-file-mentions-shared/ | Picker listed the folder inside | Outside files need a relative path |
@style after /add-dir | No suggestions | Adding a folder doesn’t add it to name search |
@private-notes.txt with a deny rule | Read failed, Claude refused | Deny rules beat mentions |
A Quick Decision Ladder
When @ lets you down, walk through these questions from the top. The first Yes is usually your fix.

Try It Yourself
Make a small practice folder with a .gitignore, a build/ folder and a couple of source files. Start Claude Code there, try @ with a partial name of an ignored file, and then type the full path. Then send this prompt:
@build/output.log and @src/app.js: tell me in two sentences what each file does.You should see two separate reads in the output. If one is missing, check whether the picker filled in a folder, and look for a deny rule in .claude/settings.json.
Common Mistakes With @ Mentions
- Pressing Tab on the first suggestion without checking whether it is a folder or a file.
- Assuming a file is missing because the picker hides it, when it is just gitignored.
- Expecting
/add-dirto make another folder’s files show up by name in the picker. - Putting
CLAUDE_CODE_DISABLE_FILE_MENTIONSin project settings and wondering why nothing changed. - Mentioning a huge log file and expecting the whole thing to be attached.
- Trusting Claude’s guess about which settings file holds a rule, instead of checking the files.
Pro Tips
- Use
.claude/settings.local.jsonforrespectGitignore: false, so the change stays on your machine. - Mention several files in one message, like
@src/a.js and @src/b.js, when Claude needs to compare them. - Mention a small file in a folder when you want that folder’s
CLAUDE.mdpicked up too. - For large monorepos, a
fileSuggestionscript backed by a prebuilt file index can give faster results. - If Claude seems to skip your project rules entirely, our fix for when Claude Code ignores CLAUDE.md covers that side.
Claude Code @ File Mentions Cheat Sheet

For other messages you might hit, see our list of Claude Code common errors. If a settings change seems to do nothing, our guide on settings.json not working explains how files override each other.
Frequently Asked Questions
Why can’t Claude Code @ find my file?
The most likely reason is that the file matches your .gitignore, which the picker hides by default. Type the full path, or set respectGitignore to false. Files outside the project need a ../ or absolute path.
Can I mention a gitignored file in Claude Code?
Yes. In our test, typing @build/output.log in full and sending it attached the ignored file. The picker just won’t suggest it unless you change the setting.
Does @ work for files in another folder?
Yes, with a relative or absolute path such as @../shared/docs/style.md. Run /add-dir as well if Claude needs to read or edit more files in that folder.
Why does @ only show a folder listing?
You mentioned a folder, not a file. Folder mentions give a listing by design. Type the full file name after the folder before you send.
Is there a size limit for @ file mentions?
Yes. The docs say a file is included when it fits the Read tool’s limit of 25,000 tokens by default, and text files over 256KB aren’t included. You can read more about the model behind it on our Claude AI page.
Conclusion
When a Claude Code @ file mention is not working, the file is almost always hidden by .gitignore, outside the project, swapped for a folder by Tab, or blocked by a Read deny rule. Type the full path first, since that worked for every readable file in our test, then set respectGitignore to false, use ../ paths for other folders, and check your deny rules, file size and the CLAUDE_CODE_DISABLE_FILE_MENTIONS variable if the file still won’t attach.


