In this categoryTroubleshooting ยท 27
- How to Fix an OpenAI 401 'Invalid API Key' ErrorStart
- How to Fix OpenAI 429 Rate Limit Errors With Backoff
- How to Fix Anthropic Claude API 401 Authentication Errors
- How to Fix Google Gemini 'API Key Not Valid' Errors
- How to Fix an API Key That Loads as Undefined
- How to Handle Anthropic 529 'Overloaded' Errors
- How to Fix Rate Limit Errors from an AI API
- How to Fix CORS Errors When Calling an AI API From the Browser
- How to Fix 'Model Not Found' and Deprecated Model Errors
- How to Rotate a Leaked API Key Without Downtime
- How to Fix SSL Certificate Errors When Calling AI APIs
- How to count tokens before sending a prompt to Claude
- How to Fix 'Context Length Exceeded' Token Limit Errors
- How to fix a context length exceeded error in the Claude API
- How to fix a Claude response that gets cut off mid-sentence
- How to reduce Claude hallucinations by grounding answers in your documents
- How to keep a long Claude conversation under the context limit
- How to stop Claude from calling tools when it should not
- How to handle a Claude Fable 5 refusal with a fallback model
- How to choose the right Claude model for cost and quality
- How to cut Claude API costs with prompt caching
- How to halve Claude costs for bulk jobs with the Batch API
- How to cap spend on a Claude agent with a task budget
- How to Debug an MCP Server That Will Not Connect
- How to Ask an Agent to Explain a Bug Before Fixing It
- How to Roll Back a Bad Deploy Quickly
- How to Fix Cursor Not Indexing Your Codebase
How to Fix Cursor Not Indexing Your Codebase
Diagnose why Cursor's codebase answers feel blind and force a clean re-index so it sees your whole project again.
When Cursor answers as if it has never seen your other files, its codebase index is usually stale or incomplete. The fix is to confirm the index status, clear it, and rebuild. This guide walks the diagnosis and the clean re-index.
What you need
- Cursor open on the affected project
- A few minutes for the index to rebuild
- About 6 minutes total
Step 1: Confirm the symptom
Ask a question that requires the wider codebase. If Cursor cannot find a function you know exists, the index is the suspect.
Step 2: Check the index status
Open Settings and find the codebase indexing section. A status stuck at a low percent, or an error, points straight at the cause.
Step 3: Check .cursorignore
An over-broad ignore file can exclude real source. Open .cursorignore and make sure it only excludes build output and dependencies, not your code directories.
node_modules/
dist/
build/
.next/
# do NOT ignore src/ or app/Step 4: Delete and rebuild
Delete the index and resync. A clean rebuild fixes a corrupted or partial index. Wait for it to reach complete before testing again.
Result: a clean, complete index, so Cursor sees your whole project again and stops answering as if half your files do not exist.
Watch related tutorials
33:42
41:18
28:05
3:12
26:54
39:10New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.