My huge python file is corrupted by Cursor

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

My python file with thousands lines of code is crashed with NULLs. Around first 3~4000 lines were replaced with NULLs and gone. Unfortunately and stupidly, I did not do the version control using git and I have no clue how I can recover this file. I tried to utilize the Timeline(Local History) but there were no existing checkpoints. I also tried to recover the conversations that I had with Cursor at least to see the edits, but I have can access conversations from 1 week ago whereas I worked on this project for about an year. I used ssh to connect to a remote Linux server while my local laptop is MacOS.

Does anyone know how to recover it..? I even tried to decompile the .pyc file but it failed since one of the functions is too complex.

Steps to Reproduce

I just turned off the Cursor window and turned it back on after 1 day.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 2.5.26 (Universal)
VSCode Version: 1.105.1
Commit: 7d96c2a03bb088ad367615e9da1a3fe20fbbc6a0
Date: 2026-02-26T04:57:56.825Z
Build Type: Stable
Release Track: Default
Electron: 39.4.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Darwin arm64 24.6.0

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the report. I can see the screenshot, it really is NUL bytes replacing the file contents. That really sucks, especially without git.

This is a known class of issues related to SSH remote and how the editor handles buffers when you close and reopen a window. A similar report was posted before: 【bug】cursor keep injecting null character to my .py file. I’ve passed this along to the team, your report helps with prioritization.

About recovery, sadly there aren’t many options without git:

  1. .pyc decompilation, you already tried this. If standard decompilers like uncompyle6 or decompyle3 can’t handle it due to complexity, try GitHub - zrax/pycdc: C++ python bytecode disassembler and decompiler · GitHub. It can handle more complex functions.
  2. Filesystem-level snapshots, check if the Linux server has snapshots (btrfs, ZFS, LVM) or any backups.
  3. Conversation history, you mentioned you only see chats from the last week. If Privacy Mode is enabled, logs aren’t saved on our side. If it isn’t, try scrolling further back in chat history.

For the future, I strongly recommend even a minimal git workflow, even just periodic commits. It’s the only reliable protection from situations like this.

Also, please update to the latest Cursor version. You’re on 2.5.26, and there have been SSH-related fixes since then.

Let me know if you manage to recover anything.

Hi. Thanks for your response.

I also tried the pycdc but it gave py file with countless errors. For the Filesystem-level snapshots, I already checked that there are no backups.

For the conversation history, do you know how to find missing histories? I am using Privacy Mode but I believe that it should still save data locally. I found out that there are multiple folders under workspaceStorage/ with their workspace.json’s folder as my current project directory. Do you have any ideas to combine all of them into one?

Also, is it correct that Cursor does not save Timeline for large files? I found out that my python file is around 300KB which seems to be higher than the limit, so I couldn’t find any logged py files under History/.

I would appreciate it if you can provide me more possible solutions… At least to recover the conversation histories.

A few notes on your requests:

Timeline/Local History and file size: yep, that’s right. VS Code, which Cursor is based on, doesn’t save Local History for files larger than 256 KB by default via workbench.localHistory.maxFileSize. Your file is about 300 KB, so there are no entries in History/. For next time, you can raise the limit in settings, for example to 1024 KB:

"workbench.localHistory.maxFileSize": 1024

Sadly, this only helps for future edits.

Conversation history and workspaceStorage: when you work over SSH, each connection with a slightly different path or context can create a separate folder in workspaceStorage. Each one has its own state.vscdb, which is a SQLite database. Try this:

  1. For each folder, check workspace.json. It’ll show the project path so you can tell which folder matches which workspace.
  2. Open each state.vscdb with sqlite3:
    sqlite3 state.vscdb "SELECT key FROM ItemTable WHERE key LIKE '%composer%' OR key LIKE '%chat%';"
    
  3. If you find chat entries, you can dump the values:
    sqlite3 state.vscdb "SELECT value FROM ItemTable WHERE key LIKE '%composer%';" > chat_dump.json
    

Also check the global state.vscdb:

~/.config/Cursor/User/globalStorage/state.vscdb

On macOS the path is ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb.

The global file has an index that points to workspace-level data. Without it, the UI doesn’t know where to look for chats, but the data can still be sitting in workspaceStorage/*/state.vscdb.

With Privacy Mode, chats should still be saved locally. It blocks sending data to servers, but it doesn’t block local storage.

For code recovery: if pycdc can’t handle it either, there aren’t many options left. You can try:

  • Check if you have cached versions in __pycache__/ from different Python versions. Sometimes there are .pyc files from older edits.
  • Look for IDE cache in ~/.config/Cursor/Cache/ or ~/.config/Cursor/CachedData/. It’s unlikely, but sometimes file fragments show up there.

Let me know if you manage to pull anything out of state.vscdb.