Claude Code @ File Mentions Not Working or Not Finding Files

Claude Code @ File Mentions Not Working or Not Finding Files

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 seeLikely causeFixHow we checked it
Typing @outp shows no suggestionsThe file is gitignoredType the full path, or set respectGitignore to falseTested
A file in a sibling folder never appearsThe picker searches your project, not other foldersStart with ../ or an absolute pathTested
Claude lists a folder instead of reading the fileTab accepted a folder like src/utils/Keep typing until the file name is completeTested
Claude says it can’t read the fileA Read deny rule matches itEdit permissions.deny if the rule is wrongTested
A big file is not includedText files over 256KB aren’t attachedAsk Claude to read part of it with its toolsFrom the official docs
Your custom picker command is ignoredA settings gate turned off fileSuggestionCheck disableAllHooks, trust and --safe-modeFrom the official docs
@ paths reach Claude, but no contentsCLAUDE_CODE_DISABLE_FILE_MENTIONS=1 is setUnset the variableFrom 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.

Diagram of the two steps of a Claude Code @ file mention: the picker suggests a path, then sending runs deny and size checks before attaching
Finding a path and attaching the file are two different steps, and each can fail for its own reasons.

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.

Claude Code @ picker listing the demo project's files and folders, followed by built-in agents
Typing a single @ in our demo project lists its files and folders, then the agents you can mention.

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.

Claude Code prompt with @outp typed and no file suggestions because build/output.log is gitignored
With the default setting, @outp finds nothing because build/output.log is gitignored.

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.

Claude Code reading build/output.log after the full path was typed with @ even though the file is gitignored
A typed full path attached the gitignored build/output.log, and Claude answered from it.

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.

Claude Code @ picker suggesting build/output.log after respectGitignore was set to false
With respectGitignore set to false in the project’s local settings, build/output.log shows up.

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.

Official Claude Code settings reference entry for respectGitignore showing the default of true
The official settings reference: respectGitignore defaults to true and also appears in /config.

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.

Claude Code @ picker suggesting a docs folder inside a sibling folder after a ../ relative path was typed
Starting with ../ lets the picker walk into a folder outside the project.

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.

Claude Code confirming a folder was added with /add-dir while @style still shows no suggestions
The folder was added for the session, but @style still found no match by name.

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.

Claude Code showing Listed directory src/utils/ after Tab accepted a folder instead of a file in an @ mention
Tab accepted the src/utils/ folder, so Claude Code attached a listing instead of the file.

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.

Official Claude Code docs tips for @ references, including that directory references show listings and paths can be relative or absolute
Anthropic’s own tips for @ references: paths can be relative or absolute, and folders give listings.

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)"]
  }
}
Claude Code reporting one failed read and saying project settings block it from reading private-notes.txt
With a Read deny rule in place, the read failed and Claude said the project settings block it.

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 typedWhat happenedLesson
@outpNo suggestionsGitignored files are hidden by default
@build/output.log what does this log say?Read the file and answeredA typed path still works
@src/ut then TabAttached the src/utils/ listingCheck the path before sending
@../at-file-mentions-shared/Picker listed the folder insideOutside files need a relative path
@style after /add-dirNo suggestionsAdding a folder doesn’t add it to name search
@private-notes.txt with a deny ruleRead failed, Claude refusedDeny 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.

Decision ladder for Claude Code @ file not working: gitignore, outside the project, folder picked by Tab, Read deny rule, big file or huge repo
Start at the top: gitignore, outside path, folder instead of file, deny rule, then size and custom pickers.

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-dir to make another folder’s files show up by name in the picker.
  • Putting CLAUDE_CODE_DISABLE_FILE_MENTIONS in 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.json for respectGitignore: 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.md picked up too.
  • For large monorepos, a fileSuggestion script 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

Claude Code @ file mentions cheat sheet with mention syntax and fixes such as respectGitignore, /add-dir, Read deny rules and fileSuggestion
Save this card: how to mention files and the setting behind each fix.

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.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top