Codex Windows app crashes on startup with "SqliteError: attempt to write a readonly database"
What version of the Codex App are you using (From “About Codex” dialog)?
26.305.950.0
What subscription do you have?
codex business
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What issue are you seeing?
The Codex Windows desktop app crashes on startup with the following main-process error:
A JavaScript error occurred in the main process
Uncaught Exception:
SqliteError: attempt to write a readonly database
I already tried Repair, Reset, uninstalling, reinstalling, and deleting local app data.
I also checked the package container under:
C:\Users\<username>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0
The container appears to be writable because files such as:
- Settings\settings.dat
- Settings\roaming.lock
- SystemAppData\Helium\User.dat
- SystemAppData\Helium\UserClasses.dat
are created or updated successfully.
Windows Defender Controlled Folder Access is disabled, and I did not find evidence that Defender or AppLocker is blocking Codex.
However, the app still crashes before becoming usable, with:
SqliteError: attempt to write a readonly database
It looks like the app may be trying to open or create a SQLite database in an unexpected non-writable location, or there may be a startup bug in version 26.305.950.0.
<img width="415" height="350" alt="Image" src="https://github.com/user-attachments/assets/21a324be-4e80-45ab-b69a-8346d65e989f" />
What steps can reproduce the bug?
- Install the Codex Windows app from the Microsoft Store.
- Launch the app.
- Wait for startup to complete.
- A dialog appears immediately with:
"A JavaScript error occurred in the main process"
"SqliteError: attempt to write a readonly database"
I can reproduce this consistently after reinstalling the app.
What is the expected behavior?
The app should start normally and initialize its local state/database in a writable per-user location without crashing.
Additional information
I already tried Repair, Reset, uninstalling/reinstalling the app, and deleting local app data before reinstalling.
I checked the package container at:
C:\Users\<username>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0
The container is writable, because files such as Settings\settings.dat, Settings\roaming.lock, SystemAppData\Helium\User.dat, and SystemAppData\Helium\UserClasses.dat are created or updated successfully.
Windows Defender Controlled Folder Access is disabled, and I did not find evidence that Defender or AppLocker is blocking the app.
No app-local .db, .sqlite, .sqlite3, or .ldb file appears to be created before the crash, which suggests the app may be opening SQLite from an unexpected non-writable location or hitting a startup bug in version 26.305.950.0.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
同样的情况!js类型写入sqlite错误。✔️我尝试把defender和其他安全组件都关闭了,用管理员权限启动codex,发现一切正常了,你可以作为参考
Workaround for Users (How to fix it now)
To fix this, you need to delete the local state database so the application can regenerate it from scratch with the new migration checksums.
Note: This will reset your local app state, but it will allow the app to launch successfully.
For Windows Users:
C:\Users\<YourUsername>\.codex\(If you are using WSL, the path is
/mnt/c/Users/<YourUsername>/.codex/)@tebriz91 Thanks, it work