Cursor AI has rapidly become one of the most popular AI-powered code editors among developers. Built on top of a familiar development environment, it offers intelligent code generation, repository-wide understanding, multi-file editing, and its powerful Agent (Composer) mode that can automate complex programming tasks in seconds.
However, these advanced AI capabilities also require significant system resources. As projects become larger and Agent sessions continue for extended periods, Cursor AI can start consuming excessive CPU and memory. Many users eventually experience typing lag, high RAM usage, slow responses, or complete editor freezes.
In most situations, these issues are caused by corrupted cache files, bloated workspace databases, or overloaded indexing processes—not by your project itself.
The good news is that you can safely fix these problems without affecting your source code.
In this complete guide, you'll learn how to clear cache error in Cursor AI code editor on Windows, macOS, and Linux, along with several advanced optimization techniques that help prevent future crashes.
Why Does Cursor AI Freeze or Show Cache Errors?
Understanding the root cause makes troubleshooting much easier.
Unlike traditional text editors, Cursor constantly performs background operations to improve its AI capabilities. Over time, these processes can consume a significant amount of system resources.
Some of the most common causes include:
1. Large Agent Session History
Every time you use Cursor's Agent or Composer mode, the editor stores conversation history, tool calls, code differences, and temporary context.
After lengthy coding sessions involving multiple files, this history becomes extremely large and can slow down the editor considerably.
2. Memory Leaks and Excessive Logging
Recent versions of Cursor have revealed situations where rejected background trace spans continually write logs.
Instead of releasing memory properly, these logs continue growing until several gigabytes of RAM are consumed, causing severe performance issues.
3. Corrupted Workspace State Database
Cursor stores information such as:
Open tabs
Window layout
Current AI chat state
Workspace preferences
This information is saved inside the state.vscdb database.
If Cursor crashes unexpectedly during a heavy AI session, this database may become corrupted. When that happens, Cursor may freeze immediately every time you reopen the project.
4. Repository Indexing Conflicts
Cursor automatically indexes repositories to power features like Instant Grep and AI search.
Very large folders—especially:
node_modules
build directories
binary assets
generated files
can overwhelm the indexing engine and quickly fill cache directories.
Cursor AI Cache Locations for Every Operating System
Before deleting anything, locate the correct cache directory for your operating system.
These are the primary locations you'll use while troubleshooting Cursor performance problems.
Operating System Cache Folder Workspace Database Windows %APPDATA%\Roaming\Cursor\Cache %APPDATA%\Roaming\Cursor\User\globalStorage\state.vscdb macOS ~/Library/Caches/Cursor ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb Linux ~/.cache/cursor-updater or ~/.config/Cursor ~/.config/Cursor/User/globalStorage/state.vscdb
Step-by-Step Guide: How to Clear Cursor AI Cache Safely
Follow the steps below carefully to restore Cursor AI without affecting your actual projects.
Step 1: Completely Close Cursor AI
Simply clicking the X button is not enough.
Make sure every Cursor background process has stopped.
Windows
Press Ctrl + Shift + Esc
Open Task Manager
End every Cursor or Code-related process
macOS
Use:
Cmd + Q
or force quit Cursor through Activity Monitor.
Step 2: Open the Cache Directory
Navigate to Cursor's cache folder.
Windows
Press:
Win + R
Enter:
%APPDATA%\Cursor\
Open the following folders if available:
Cache
CachedData
GPUCache
Step 3: Delete the Cache Files
Delete everything inside the Cache directory.
This operation is completely safe.
Removing cache files does not delete:
your source code
Git repositories
project folders
extensions
keyboard shortcuts
editor settings
The cache only stores temporary compiled resources, interface snapshots, and AI response data.
Step 4: Reset the Workspace Database
If Cursor still freezes every time a specific workspace opens, the issue is likely the workspace database.
Navigate to:
Cursor/User/globalStorage/
Locate:
state.vscdb
Either:
delete the file
or
rename it to
state.vscdb.bak
When Cursor launches again, it automatically creates a fresh database.
This is often the most effective fix for persistent startup crashes.
Important Warning Before Deleting state.vscdb
Deleting state.vscdb resets:
window layout
local chat history
active workspace state
You'll need to sign back into your Cursor account after restarting.
However, your:
Git repositories
project files
source code
workspace folders
remain completely safe.
Advanced Fixes to Prevent Future Cursor AI Crashes
Clearing the cache solves the immediate problem, but optimizing Cursor's settings can prevent the issue from returning.
Disable Repository Indexing
Cursor's experimental repository indexing can consume substantial resources on large projects.
To disable it:
Open Cursor Settings
Click the Indexing & Docs tab.
Turn Index Repositories for Instant Grep (BETA) OFF.
If you work with very large enterprise repositories, disable Codebase Indexing completely.
This significantly reduces CPU usage on many systems.
Create a .cursorignore File
Just like .gitignore, Cursor supports its own ignore file.
Create a file named:
.cursorignore
Add:
node_modules/
.git/
dist/
build/
*.log
.next/
Ignoring these folders prevents Cursor from wasting resources indexing unnecessary files.
Fix HTTP/2 Network Timeout Issues
Long-running Agent operations sometimes trigger HTTP/2 socket timeout errors that generate excessive internal logs.
To disable HTTP/2:
Open the Command Palette:
Ctrl + Shift + P
or Cmd + Shift + P
Choose:
Preferences: Open User Settings (JSON)
Add:
"cursor.general.disableHttp2": true
Save the file and restart Cursor.
This forces the editor to use the more stable HTTP/1.1 connection for Agent requests.
Best Practices to Keep Cursor AI Running Smoothly
Following a few simple habits can dramatically improve Cursor's long-term performance.
Close Old AI Conversations
Agent sessions consume memory even after they are no longer active.
Regularly close completed Composer and chat tabs instead of letting dozens remain open.
Open Smaller Project Folders
Instead of loading an entire enterprise monorepo, open only the service or module you're currently working on.
Smaller workspaces mean:
faster indexing
less memory usage
quicker AI responses
Monitor Process Explorer
If Cursor suddenly becomes slow:
Open the Command Palette and search:
Developer: Open Process Explorer
Look for processes like:
extensionHost
ptyHost
If either is using unusually high CPU resources, you've likely identified the source of the slowdown.
Cursor AI is an incredibly capable development environment, but its advanced AI features also require careful resource management. Extended Agent sessions, continuous repository indexing, and persistent workspace history can eventually overwhelm your system, resulting in lag, freezes, or unexpected crashes.
Fortunately, most of these issues can be resolved by safely clearing the Cursor cache, resetting the state.vscdb workspace database, disabling unnecessary indexing features, using a properly configured .cursorignore file, and applying the HTTP/2 network timeout fix.
By following the steps outlined in this guide, you can restore Cursor AI to peak performance without risking your project files or development environment. Whether you're working on a small application or a large enterprise codebase, these maintenance practices will help keep Cursor fast, responsive, and ready for every coding session.
Frequently Asked Questions (FAQs)
1. Is it safe to clear the Cursor AI cache?
Yes. Clearing the Cursor AI cache is completely safe. It only removes temporary files such as cached data, compiled resources, and old AI response snippets. Your project files, source code, Git repositories, extensions, and personal settings remain unaffected.
2. Will deleting state.vscdb remove my project files?
No. Deleting or renaming the state.vscdb file does not delete your project or source code. It only resets Cursor's workspace state, including window layout, open tabs, and local AI chat history. You may need to sign back into your Cursor account after restarting the editor.
3. Where is the Cursor AI cache folder located on Windows?
On Windows, the primary Cursor AI cache folder is located at:
%APPDATA%\Roaming\Cursor\Cache
The workspace database file is located at:
%APPDATA%\Roaming\Cursor\User\globalStorage\state.vscdb
4. Why does Cursor AI freeze during long Agent sessions?
Cursor AI can freeze because long Agent sessions consume large amounts of memory. Chat history, code indexing, repository scanning, and temporary AI context continue growing over time. Corrupted cache files or the state.vscdb database can also cause the editor to become unresponsive.
5. How can I stop Cursor AI from crashing repeatedly?
To reduce crashes:
Clear the Cursor cache folder regularly.
Reset the
state.vscdbdatabase if workspaces won't open.Disable Repository Indexing for large projects.
Create a
.cursorignorefile.Enable the
"cursor.general.disableHttp2": truesetting.Close unused AI chat sessions frequently.
6. Does clearing the Cursor cache improve performance?
Yes. Removing old cache files often reduces startup time, lowers memory usage, improves typing responsiveness, and fixes freezes caused by corrupted temporary files.
7. What is the purpose of the .cursorignore file?
A .cursorignore file tells Cursor AI which folders and files should not be indexed. Ignoring directories like node_modules, .git, build, dist, and .next reduces unnecessary scanning and significantly improves performance on large projects.
8. Should I disable Repository Indexing in Cursor AI?
If you're working on large repositories or enterprise monorepos and experiencing high CPU usage or frequent freezes, disabling Repository Indexing or Instant Grep (Beta) can greatly improve performance.
9. Why does Cursor AI use so much CPU and RAM?
Cursor continuously indexes your project, processes AI requests, stores chat history, and analyzes multiple files in the background. Large repositories, long Agent sessions, and memory leaks can increase CPU and RAM usage significantly.
10. What should I do if Cursor AI still freezes after clearing the cache?
If the issue continues after clearing the cache:
Delete or rename
state.vscdb.Restart Cursor AI.
Disable Repository Indexing.
Add a
.cursorignorefile.Apply the HTTP/2 network timeout fix.
Update Cursor AI to the latest version.
If none of these steps resolve the issue, consider reinstalling Cursor AI while keeping a backup of your settings.