Back to AI Q&A
Why does Cursor always say that the project code cannot be found? Let's take a look at Indexing, . cursorignore and included files

Why does Cursor always say that the project code cannot be found? Let's take a look at Indexing, . cursorignore and included files

AI Q&A Admin 107 views

Why does Cursor keep saying "I didn't find the code in the project"? Many times it's not that the model suddenly becomes stupid, but that your code is not indexed by it at all. Cursor officially states clearly in both Codebase Indexing and Ignore files : Cursor automatically indexes the codebase, but skips '.gitignore', '.cursorignore', and additional ignore rules.

The most common misconceptions

Many people think that "if I can see this file locally, Cursor will definitely be able to see it". Actually not. As long as this directory is ignored, Tab, Agent, Inline Edit, and even the '@' reference may not get it. This is especially common in large repositories, monorepos, and front-end build directories.

The official recommendation is to find out where first

  • Go to Cursor Settings > Indexing & Docs to see the index status.
  • Click View included files to see which files it counts.
  • Check for '.cursorignore', '.gitignore', and additional ignore rules.

If you find that it always answers questions, don't rush to change the model, first check if it sees the correct file. Many so-called "Cursor can't find code" end up being too harsh in the index range, or ignoring the rules to block the key directories together.

Recommended Tools

More