Codex Windows app crashes on startup with "SqliteError: attempt to write a readonly database"

Open 💬 4 comments Opened Mar 8, 2026 by chenhongyuan1
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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?

  1. Install the Codex Windows app from the Microsoft Store.
  2. Launch the app.
  3. Wait for startup to complete.
  4. 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.

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #13553
  • #12974

Powered by Codex Action

a1409606731 · 5 months ago

同样的情况!js类型写入sqlite错误。✔️我尝试把defender和其他安全组件都关闭了,用管理员权限启动codex,发现一切正常了,你可以作为参考

tebriz91 · 3 months ago

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:

  1. Close the Codex application completely.
  2. Open File Explorer and navigate to your user profile's .codex directory: C:\Users\<YourUsername>\.codex\
  3. Delete the following files (if they exist):
  • state_5.sqlite
  • state_5.sqlite-shm
  • state_5.sqlite-wal
  1. Launch the application again.

(If you are using WSL, the path is /mnt/c/Users/<YourUsername>/.codex/)

nguyenytran · 3 months ago

@tebriz91 Thanks, it work