r/codex • u/palanzana • Oct 12 '26
Bug [SOLVED] Codex Projects Disappeared After Crash/Restart on Windows 11 — Full Recovery Guide + Python Script
I managed to recover all my missing Codex projects after a Windows 11 system crash, and I wanted to share the solution in case it helps others experiencing the same frustrating issue.
The good news: you may be able to recover your projects without reinstalling Codex, losing conversations, or manually editing the SQLite database.
🔴 The Problem
After my computer crashed and I restarted Windows, Codex suddenly stopped displaying my projects in the left sidebar.
Symptoms:
The Projects section displayed "No projects".
All my previous conversations were still visible under "Recents".
The original project organization had completely disappeared.
Restarting Codex did not solve the problem.
I had also migrated my Codex data from another computer previously, but everything had been working correctly until this crash.
🔍 What I Discovered
Codex stores local information in:
C:\Users\YOUR_USERNAME\.codex
Two important files are:
state_5.sqlite— contains project and conversation records..codex-global-state.json— contains local UI state, including project information.
My diagnostic results were:
| Item | Result |
|---|---|
| SQLite integrity | OK |
| Projects in SQLite | 4 |
| Project records in JSON | 0 |
| Conversations in database | 364 |
| Conversations with matching project paths | 326 (estimated) |
The projects were still recorded in SQLite, but the JSON project index was missing its entries.
This suggested that rebuilding the JSON project registry might restore the sidebar.
🛠️ How I Fixed It
I used a small Python recovery script that reads the existing SQLite project records and reconstructs the missing JSON entries.
Step 1 — Close Codex completely
Exit Codex and make sure no related processes are running in Windows Task Manager.
Step 2 — Back up your data
Open PowerShell and run:
Copy-Item "$HOME\.codex" "$HOME\Desktop\codex-backup" -Recurse -Force
Keep this backup until you have verified the recovery.
Step 3 — Download the recovery script
Download the Python script and README:
Recovery script + instructions:
https://github.com/user-attachments/files/33326215/Codex_Windows_Project_Recovery.zip
Extract the ZIP and place recupera_progetti_codex.py on your Desktop.
Python 3 is required.
Step 4 — Run diagnostics first
Open PowerShell and execute:
py -3 "$HOME\Desktop\recupera_progetti_codex.py"
The script will report:
SQLite database integrity.
Number of projects stored in SQLite.
Number of projects registered in JSON.
Number of conversations.
Original project names and folder paths.
Missing or inaccessible project directories.
Diagnostic mode does not modify any files.
Check the results carefully before proceeding.
Step 5 — Check missing project directories
In my case, one project directory no longer existed because I had previously transferred my Codex data between computers.
The script identified the missing path and warned me.
I recreated the missing directory before continuing.
If this happens to you, verify whether the original directory was moved or deleted. Recreating an empty directory can restore a valid project path, but it will NOT recover any missing source files.
Step 6 — Restore the projects
With Codex still closed, run:
py -3 "$HOME\Desktop\recupera_progetti_codex.py" --apply
The script creates a backup of the state file before making changes.
It will ask you to type:
RIPRISTINA
This confirmation is intentional to prevent accidental modifications.
The recovery process rebuilds the project entries in .codex-global-state.json using information from SQLite.
It does not modify the SQLite database or delete conversations.
Step 7 — Restart Codex
Open Codex again.
In my case, all 4 projects immediately reappeared in the sidebar!
The original project names and organization were restored. I also confirmed that the conversations database remained intact, although I haven't individually verified every historical conversation assignment.
✅ Final Result
Before recovery:
0 projects displayed.
364 conversations in the database.
Projects missing from the sidebar.
After recovery:
All 4 projects restored.
No Codex reinstallation required.
No manual SQLite editing.
No need to recreate projects one by one.
⚠️ Important Notes
This is an unofficial, community-shared workaround, not an official OpenAI repair tool.
Always back up your entire
.codexfolder first.Review the Python script before running it.
Run diagnostic mode before using
--apply.Make sure Codex is completely closed.
Do not overwrite your current data with an outdated backup.
This method may not work with every Codex version or every cause of missing projects.
Recovering the project index does not guarantee recovery of missing source files or every conversation association.
The most important discovery was that even when Codex displays "No projects", the project records may still exist in state_5.sqlite**.**
So don't immediately delete your Codex data or start rebuilding everything manually.
Hopefully this guide helps anyone who loses their projects after a Windows crash, restart, update, or migration.
If it works for you, please leave a comment with your Codex version and how many projects you recovered. It could help identify how widespread this problem is.
And hopefully the Codex team can implement an automatic recovery mechanism for this issue in a future release!
2
u/RagingCookie93 Oct 13 '26
Lifesaver! Just happened to me after an unplanned restart and lost all my projects due to a corrupt config.toml. Followed your guide and restored everything perfectly 💪🏻💪🏻
1
2
2
2
u/Historical_Night_754 10d ago
Muito obrigado, resolveu aqui também. Já estava completamente perdido sem a organização dos projetos rs Obrigado por compartilhar.
1
2
u/Jake1983 27d ago
Had the same issue come up after an unexpected restart. This fixed the problem. 10 projects were recovered.
May I translate your script to English to have for myself in case this happens again?