Submit a toolSubmit

Cursor Agent can’t open a file. Check .cursorignore, .gitignore, and the default ignore list

If Agent, Tab, or @ can’t see a path, `.cursorignore`, `.gitignore`, a default ignore, or a global ignore is hiding it. Negate it with `!` or narrow the rule. Short answer: 5 steps. 1) Prove the path is ignored; 2) Read .cursorignore and .gitignore; 3) Check Cursor’s default ignore list and global ignores; 4) Fix negation patterns the gitignore way; 5) Unblock Agent access, keep secrets out.

Last updated: · This page is the decision checklist; the tools list for “Unblock files Cursor Agent ignores” is a separate URL.

The problem: If Agent, Tab, or @ can’t see a path, `.cursorignore`, `.gitignore`, a default ignore, or a global ignore is hiding it. Negate it with `!` or narrow the rule.

How do I check .cursorignore, .gitignore, and the default ignore list?

  1. Prove the path is ignored

    In the project root, run `git check-ignore -v path/to/file` (works for `.gitignore` and helps debug ignore rules). Try `@`-mentioning the file in Agent chat. If Cursor blocks it while the file exists on disk, treat it as an ignore problem—not a missing file. Official ignore reference: https://cursor.com/docs/reference/ignore-file

  2. Read .cursorignore and .gitignore

    Open the project `.cursorignore` and `.gitignore`. Cursor respects `.gitignore` automatically; `.cursorignore` adds more exclusions. Broad patterns like `src/**`, `*.md`, or `config/` often hide the exact files Agent needs. Comment out or narrow the pattern, then retry the `@` mention.

  3. Check Cursor’s default ignore list and global ignores

    Cursor also ignores a built-in set (for example `.env*`, `.git/`, lockfiles, `node_modules/`, many binaries and media types). Override a default or gitignore exclusion with a `!` negation in `.cursorignore` (for example `!important.env.example`). Global ignore patterns in Cursor Settings apply to every project—clear or narrow those if a path is blocked everywhere. Help: https://cursor.com/help/customization/ignore-files

  4. Fix negation patterns the gitignore way

    You cannot re-include a nested file if a parent directory was excluded with a directory pattern. Prefer `public/assets/*` plus `!public/assets/style.css` over excluding all of `public/` then trying to un-ignore a deep file. Enable Hierarchical Cursor Ignore in Settings → Indexing → Ignore Files if parent-folder `.cursorignore` files should apply.

  5. Unblock Agent access, keep secrets out

    After the needed source file is visible to `@` and Agent tools, leave real secrets ignored. Remember: Terminal and MCP tools used by Agent are not governed by `.cursorignore`, so a shell `cat` can still read ignored files—don’t rely on ignore alone as a security boundary. Prefer `@` path for specific files once ignore rules are fixed.

Which tools are best to unblock files Cursor Agent ignores?

Ignore file reference

What .cursorignore blocks, default ignore list, negation limits, hierarchical ignore.

Ignore files help

Short guide: .cursorignore vs .gitignore and why to exclude secrets and build output.

Agent search tools

How Agent finds code with Instant Grep / search when files are visible.

Cursor Agent troubleshooting

Broader Agent checklist when tools fail for reasons other than ignore rules.

All tools for “Unblock files Cursor Agent ignores” →

Related fixes

See also AI tools launched today on the daily board.