Troubleshooting & Reference
Common issues, migration from legacy formats, Run Modes safety, and keyboard shortcut reference.
title: "Troubleshooting & Reference" description: "Common issues, migration from legacy formats, Run Modes safety, and keyboard shortcut reference." section: "Full Guide" readTime: "7 min"
Troubleshooting & Reference
Quick fixes for common Cursor issues and a short keyboard shortcut reference.
Migrating Legacy Config
.cursorrules → .cursor/rules/*.mdc or AGENTS.md
The single-file .cursorrules format is the legacy approach. Split it into rule files with frontmatter, or move simple instructions into AGENTS.md.
Before (.cursorrules):
Always use TypeScript.
Never use any type.
Use Tailwind for styling.
After (.cursor/rules/01-code-style.mdc):
---
description: Code style conventions
alwaysApply: true
---
# Code Style
- Always use TypeScript
- Never use `any` type — use `unknown` and narrow
- Use Tailwind CSS for all styling — no inline stylesSteps:
- Read
.cursorrulescontents - Group by category (style, testing, patterns, etc.)
- Create files such as
01-code-style.mdc,02-testing.mdc - Add frontmatter to each:
alwaysApply: true, orglobs, or adescriptionfor agent-decided rules - Delete
.cursorrules
Rule files must be .mdc
Project rules in .cursor/rules/ use the .mdc extension. Plain .md files in that folder are not loaded as rules. If you have .md rule files, rename them:
# In your .cursor/rules/ directory
for file in *.md; do mv "$file" "${file%.md}.mdc"; doneNo content changes needed. If you just want plain markdown with no frontmatter, use AGENTS.md instead.
Common Rule Mistakes
| Mistake | Problem | Fix |
|---|---|---|
| Rule for optional workflows | Agent applies it when not needed | Make it a skill in .cursor/skills/<name>/SKILL.md; invoke with /skill-name |
| Enforcement left to prompts | Rules guide the model but aren't guaranteed | Use a hook (beforeShellExecution, afterFileEdit) for hard checks |
| One monolithic rule file | Hard to maintain, over 500 lines | Split by domain: style, tests, security, patterns |
| Rules without examples | Agent interprets loosely | Reference example files or add short before/after snippets |
alwaysApply: true on everything | Context bloat | Reserve it for universal constraints; use globs or a description for the rest |
Rule file is .md | Not loaded | Rename to .mdc |
| Frontmatter mismatch | Rule never attaches | Check: globs only matches files in context; manual rules need an @ mention |
Run Modes Safety
Run Modes control how much autonomy the agent has for shell, MCP, and Fetch calls. Set them in Settings > Agents > Approvals & Execution. (The older informal name "YOLO mode" roughly corresponds to Run Everything.)
| Mode | Behavior |
|---|---|
| Auto-review (recommended) | Allowlisted calls run immediately. Shell commands run in a sandbox when possible. Other calls are reviewed by an LLM classifier |
| Allowlist | Allowlisted actions run without approval; everything else asks |
| Run Everything | Every tool call runs with no prompts, and no sandbox |
Rule: don't use Run Everything on a machine with credentials or production access. Prefer Auto-review or Allowlist.
The sandbox limits where terminal commands can read, write, and connect. By default workspace files are accessible and protected paths such as .git/hooks are guarded. Customize it with sandbox.json in ~/.cursor/ (all projects) or <project>/.cursor/ (one project). Auto-review reads permissions.json from the same locations, and team dashboard settings override both.
For hard guarantees, add a beforeShellExecution hook that denies dangerous commands:
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{
"command": ".cursor/hooks/guard-shell.sh",
"matcher": "rm |git push|npm publish",
"failClosed": true
}
]
}
}The script reads JSON on stdin and prints {"permission": "deny"} (or allow / ask). Exit code 2 also blocks the action.
Indexing Issues
Symptom: Responses are slow, search misses files, the agent doesn't know about recent changes.
Diagnose: Open Cursor Settings > Indexing and check what's included.
Fixes:
| Symptom | Fix |
|---|---|
| Expected files missing | Check .cursorignore and .gitignore; Cursor ignores both |
| Agent sees stale code | Reopen the workspace; confirm the folder you opened is the repo root |
| Large repo is slow | Open the subfolder you work in, or exclude generated output |
| Private files in responses | Add them to .cursorignore (not a hard guarantee for terminal and MCP tools), and keep secrets out of the repo |
| Ignore pattern not working | Test it with git check-ignore -v <file>; you can't re-include a file under an excluded parent directory |
Sample .cursorignore (on top of the built-in defaults, which already cover .gitignore, node_modules/, and .env*):
secrets/
**/*.pem
*.generated.ts
Context Drift Signs
Your session has drifted when:
- Agent ignores rules it was following earlier
- Suggestions repeat a mistake you already corrected
- Agent proposes patterns that don't match your codebase style
- Responses get worse over time in the same session
Fix: Start a new chat. Don't try to correct drift with more prompts.
# Start a fresh chat with:
"Continuing [specific task].
Previous session: [2-3 bullet summary of what was done]
Next step: [exactly one thing]
@relevant-file.ts"
You can also attach the old conversation with @Chats.
Debugging Workflow Issues
Agent keeps re-implementing already solved things:
- Reference the existing implementation:
"Don't re-implement X — it already exists in @src/lib/x.ts. Just use it."
Agent ignores type constraints:
- Attach the relevant type file
- Add
"Use ONLY the types defined in @src/types/ — do NOT invent new types"
Generated tests don't test the right behavior:
- Provide the spec explicitly
- Reference an existing test as the pattern:
@src/api/orders.test.ts - Say what must be covered:
"Must test: success case, validation failure, 404, and 500 error handling"
Agent goes off on tangents:
- One task per chat
- End prompts with:
"Do not change anything outside of [specific file/function]." - Use Plan Mode (
Shift+Tab) first for ambiguous tasks - Restore a checkpoint (restores files, not chat history) or
git restoreif it went too far
Elusive or intermittent bug: switch to Debug Mode from the mode picker.
Tab suggestions are annoying or wrong: click the Tab indicator in the bottom-right corner to snooze it or disable it for certain file types.
Keyboard Shortcuts Reference
Windows/Linux keys shown; on macOS use Cmd for Ctrl and Option for Alt. The full list is in the keyboard shortcut reference.
| Action | Windows / Linux |
|---|---|
| Toggle Agent panel | Ctrl+I or Ctrl+L |
| New chat | Ctrl+N or Ctrl+R |
| Add selected code to chat | Ctrl+Shift+L |
| Inline Edit | Ctrl+K |
| Open mode menu | Ctrl+. |
| Rotate Agent modes | Shift+Tab |
| Submit (queued if the agent is busy) | Enter |
| Send immediately | Ctrl+Enter |
| Accept / dismiss Tab suggestion | Tab / Esc |
| Accept next word of Tab suggestion | Ctrl+Right |
| Command palette | Ctrl+Shift+P |
| Cursor settings | Ctrl+Shift+J |
Quick Reference: File Locations
| File | Purpose | Type |
|---|---|---|
.cursor/rules/*.mdc | Persistent coding conventions | Rules |
AGENTS.md | Plain-markdown project instructions | Rules |
.cursor/skills/<name>/SKILL.md | On-demand workflows (/skill-name) | Skills |
.cursor/commands/*.md | Reusable prompts (/name) | Commands |
.cursor/hooks.json | Lifecycle hooks | Config |
.cursor/mcp.json | MCP server configuration | Config |
.cursor/worktrees.json | Worktree setup commands | Config |
.cursor/BUGBOT.md | Context for Bugbot PR reviews | Config |
.cursorignore | Files Cursor must not access | Config |