---
name: cursor-indexing-issues
description: 'Troubleshoot Cursor codebase indexing: stuck indexing, empty search, @codebase failures, and

  performance issues. Triggers on "cursor indexing", "cursor index", "@codebase not working",

  "cursor search broken", "indexing stuck".'
allowed-tools: Read, Write, Edit, Bash(cmd:*)
version: 1.19.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
tags:
  - saas
  - cursor
  - cursor-indexing
compatibility: Designed for Claude Code
title: cursor-indexing-issues
canonical_url: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues
last_updated: 2026-10-07T06:06:28.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/.cursorignore-configuration.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues/references/.cursorignore-configuration.md), [references/common-indexing-issues.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues/references/common-indexing-issues.md), [references/errors.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues/references/errors.md), [references/examples.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues/references/examples.md), [references/index-verification.md](https://skilld.dev/api/skills-raw/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues/references/index-verification.md).
>
> If the user asked to install this Skill, run `npx skilld install jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/cursor-indexing-issues`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/jeremylongshore/tons-of-skills-marketplace/cursor-indexing-issues) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/cursor-indexing-issues`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/cursor-indexing-issues --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/cursor-indexing-issues --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Cursor Indexing Issues

## Overview

Diagnose missing, stale, slow, or over-broad codebase indexing while keeping sensitive and generated files excluded from AI context.

## Prerequisites

- The affected workspace, expected file/path, current ignore configuration, and a non-sensitive reproduction.
- Authority to inspect repository indexing settings without weakening data-exclusion rules.

## Instructions

1. Confirm the file is inside an approved workspace root and not intentionally excluded by ignore configuration.
2. Check index status, refresh only the affected workspace, and compare the result against a known expected file.
3. Change ignore/rule configuration through normal review, then verify both inclusion of required files and exclusion of sensitive paths.

## Output

- A scoped indexing diagnosis with a verified inclusion/exclusion result.

## Error Handling

| Condition | Safe response |
|---|---|
| Sensitive file is indexed | Stop sharing context, add/repair the exclusion, and follow exposure policy. |
| Index remains stale | Capture redacted diagnostics and escalate; do not remove all ignore controls. |
| Large repository is slow | Narrow workspace roots and generated-file scope before resyncing. |

## Examples

When `src/service.ts` is absent, verify its root and ignore rules, resync indexing, then ask a minimal chat to reference only that file. If a `.env` file becomes visible during testing, stop and correct the exclusion before continuing.

Diagnose and fix codebase indexing problems. Covers stuck indexing, empty search results, stale results, and performance optimization for large codebases.

## Quick Diagnosis

| Symptom | Likely Cause | Quick Fix |
|---------|-------------|-----------|
| Status bar stuck on "Indexing..." | Large codebase or network issue | Add `.cursorignore`, resync |
| @Codebase returns nothing | Index not built or file excluded | Wait for index, check ignore files |
| @Codebase finds wrong code | Stale index | Resync index |
| Indexing crashes / restarts | Memory or file watcher limits | Increase limits, reduce scope |
| "Unable to index" error | Network blocked or auth expired | Check proxy/firewall, re-auth |

## Fix: Stuck Indexing

### Step 1: Reduce Scope

Create or update `.cursorignore` in project root:

```gitignore
# .cursorignore -- exclude non-essential directories

# Build output
dist/
build/
.next/
out/
target/

# Dependencies (always exclude)
node_modules/
vendor/
.venv/
venv/

# Generated / large files
*.min.js
*.min.css
*.bundle.js
*.map
*.lock
package-lock.json
yarn.lock
pnpm-lock.yaml

# Data files
*.csv
*.sql
*.sqlite
*.parquet
*.json.gz
fixtures/

# Media
*.png
*.jpg
*.gif
*.svg
*.mp4
*.woff2
```

### Step 2: Resync Index

`Cmd+Shift+P` > `Cursor: Resync Index`

### Step 3: Clear Cache (if resync fails)

```bash
# macOS
rm -rf ~/Library/Application\ Support/Cursor/Cache/
rm -rf ~/Library/Application\ Support/Cursor/CachedData/

# Linux
rm -rf ~/.config/Cursor/Cache/
rm -rf ~/.config/Cursor/CachedData/

# Windows (PowerShell)
Remove-Item -Recurse "$env:APPDATA\Cursor\Cache"
Remove-Item -Recurse "$env:APPDATA\Cursor\CachedData"
```

Restart Cursor after clearing cache. Full re-index begins automatically.

## Fix: @Codebase Returns No Results

### Check 1: Is Indexing Complete?

Look at the bottom status bar. If it says "Indexing...", wait for it to finish. For projects with 10K+ files, initial indexing can take 10-30 minutes.

### Check 2: Is the File Excluded?

A file might be excluded by:

1. `.gitignore` (Cursor respects this by default)
2. `.cursorignore` (explicit exclusion)
3. `.cursorindexingignore` (excluded from index but not from AI features)

Verify: `Cursor Settings` > `Features` > `Codebase Indexing` > `View included files`

This opens a text file listing all indexed paths. Search for the file you expect to find.

### Check 3: Network Connectivity

Indexing requires network access to Cursor's embedding API. Test:

- Can you access `api.cursor.com`?
- Is a corporate proxy blocking outbound HTTPS?
- Is a VPN interfering?

### Check 4: Semantic vs Keyword Search

`@Codebase` uses semantic search (embeddings), not keyword matching. The query "authentication middleware" will find files about auth even if they never use the word "middleware." But it may miss files if the semantic meaning is very different from the query.

For exact keyword matching, use `Cmd+Shift+F` (workspace search) instead.

## Fix: Stale / Outdated Results

Cursor re-checks for file changes every 10 minutes using a Merkle tree. If you need fresher results:

1. Save all open files
2. `Cmd+Shift+P` > `Cursor: Resync Index`
3. Wait for "Indexed" status to reappear
4. Retry your `@Codebase` query

## Performance Optimization for Large Projects

### Indexing Time Benchmarks

| Project Size | Files Indexed | Initial Index Time |
|-------------|--------------|-------------------|
| Small (< 1K files) | ~500 | < 30 seconds |
| Medium (1K-10K files) | ~5,000 | 1-5 minutes |
| Large (10K-50K files) | ~20,000 | 5-30 minutes |
| Very large (50K+) | ~50,000+ | 30 min - 2 hours |

### Monorepo Strategy

Do not open the entire monorepo root. Instead:

```bash
# Open just the package you're working on:
cursor packages/api/

# Or use .cursorignore to exclude other packages:
# .cursorignore
packages/web/
packages/mobile/
packages/admin/
packages/deprecated-*
```

### Linux File Watcher Limits

If indexing crashes on Linux with large projects:

```bash
# Check current limit
cat /proc/sys/fs/inotify/max_user_watches

# Increase to 524288 (persists across reboots)
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
```

### Memory Pressure

If Cursor runs out of memory during indexing:

```json
// settings.json
{
  "files.maxMemoryForLargeFilesMB": 4096,
  "files.watcherExclude": {
    "**/node_modules/**": true,
    "**/.git/**": true,
    "**/dist/**": true,
    "**/build/**": true
  }
}
```

## .cursorignore vs .cursorindexingignore

| File | Indexed? | Available to AI? | Use Case |
|------|----------|-----------------|----------|
| Listed in `.cursorignore` | No | No (best effort) | Secrets, large binaries, build output |
| Listed in `.cursorindexingignore` | No | Yes (via @Files) | Test fixtures, docs, large but useful files |
| Not in any ignore file | Yes | Yes | Your source code |

Use `.cursorindexingignore` for files you want to reference explicitly but not have polluting search results:

```gitignore
# .cursorindexingignore
tests/fixtures/large-sample.json
docs/api-spec.yaml
e2e/recordings/
```

## Enterprise Considerations

- **Data residency**: Embeddings stored in Turbopuffer cloud. No plaintext code stored, but metadata (obfuscated filenames) exists server-side
- **Air-gapped environments**: Indexing requires outbound HTTPS. Not available in fully air-gapped setups
- **Index freshness SLA**: 10-minute polling interval is not configurable. Manual resync is the only way to force immediate re-index
- **Audit**: No logging of which files are indexed. Use `.cursorignore` proactively for regulated data

## Resources

- [Codebase Indexing Docs](https://docs.cursor.com/context/codebase-indexing)
- [Ignore Files](https://docs.cursor.com/context/ignore-files)
- [Secure Codebase Indexing](https://cursor.com/blog/secure-codebase-indexing)
