You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
on mac after codex update: Codex cannot access its local database. #24006
What version of the Codex App are you using (From “About Codex” dialog)?
it conn't open
What subscription do you have?
pro
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
Codex cannot access its local database.
The app cannot finish launching until its SQLite database is accessible.
Database path: Path unavailable in app-server startup error
Close other Codex applications, then click Retry to check whether access has been restored.
Error: (code=1, signal=null).
Most recent error: Error: failed to initialize sqlite state runtime under /Users/xxx/.codex: failed to initialize state runtime at /Users/xxxx/.codex: error returned from database: (code: 11) database disk image is malformed
What fixed it was not just renaming the .sqlite files. The missing piece was that Codex’s recovery flow expected this
directory to exist:
~/.codex/db-backups
In your case it did not exist, so “Back Up and Rebuild” failed with:
Recovery failed: ENOENT: no such file or directory, mkdir 'db-backups'
Here’s the exact summary you can post:
I was able to fix this by manually creating Codex’s missing backup directory and moving the active SQLite database
files out of the way.
The error dialog said Codex could not access its local SQLite database, and the recovery step failed with:
Recovery failed: ENOENT: no such file or directory, mkdir 'db-backups'
What worked:
mkdir -p ~/.codex/db-backups/manual-backup
find ~/.codex ~/.codex/sqlite -maxdepth 1 -type f \
\( -name '*.sqlite' -o -name '*.sqlite-wal' -o -name '*.sqlite-shm'\) \
-exec mv {} ~/.codex/db-backups/manual-backup/ \;
Then I clicked Retry / restarted Codex, and Codex recreated fresh SQLite files automatically.
Notes:
- I backed up the files instead of deleting them.
- Moving only .sqlite files was not enough because SQLite also had -wal and -shm sidecar files.
- The key extra fix was creating ~/.codex/db-backups, because Codex’s built-in recovery was failing when that
directory was missing.
One caveat: the simple command above flattens files from `~/.codex/sqlite` into the same backup folder. What I
actually ran preserved the `sqlite/` subfolder too, but for most users the simpler version is probably enough unless
there are filename collisions.
The dialog was misleading — your database was never actually corrupt (integrity_check and quick_check both returned ok). The real problem was a crash-looping process stack: a background codex app-server daemon and a codex-aar helper kept dying and respawning, each grabbing a lock on state_5.sqlite, so every relaunch failed to initialize the sqlite runtime. The in-app "Back Up and Rebuild" button couldn't help because it had its own bug (ENOENT … mkdir 'db-backups' — it tries to create that folder from a working directory that no longer exists).
What I did:
Killed the entire Codex.app process tree.
Confirmed all databases were released.
Folded the stray large write-ahead log back into logs_2.sqlite (wal_checkpoint(TRUNCATE)), verified integrity.
Relaunched Codex — the app-server is now stable and got all the way past DB init into normal network operation. No more sqlite/db-backups errors in the log.
Activity
github-actions commentedon May 22, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Toolenaar commentedon May 22, 2026
Same Issue a simple reinstall does not fix it. Anyone have a fix ?
rbbp23 commentedon May 22, 2026
Same issue here... I tried renaming logs_2.sqlite like people said in the other tickets, but no luck. I can't start de app anymore.
pioneerLEE commentedon May 23, 2026
Same issue here too
olaaroub commentedon May 26, 2026
I got the same issue today, did anyone fix it?
FeVeR-Store commentedon May 26, 2026
Renaming state_5.sqlite had the effect.
jiahao-oai commentedon May 29, 2026
You can fix it by
mv ~/.codex/state_5.sqlite ~/.codex/state_2.sqliteinRush commentedon Jun 1, 2026
You can use codex cli to start it again, codex cli will automatically fix this problem
valentina-di-vincenzo commentedon Jun 1, 2026
Same issue here after an update. Renaming worked.
neverforgit commentedon Jun 4, 2026
I did not have the ~/.codex/state_*.sqlite files present, so that does not work.
But @inRush's solution worked for me. Thank you!
System: macOS 26.5 arm64
wangskyone commentedon Jun 18, 2026
Workaround: reset Codex SQLite state
I ran into an issue where Codex could no longer open, and the root cause appeared to be related to its local SQLite state files.
The workaround that fixed it for me was:
.sqlitefiles under any.codexdirectory..sqlitefiles to keep them as backups, for example:file.sqlite -> file.sqlite.bakAfter doing this, Codex was able to start normally again.
Note that this may reset some local Codex state, but the original SQLite files are still preserved as
.bakbackups in case they are needed later.aliyovic commentedon Jun 19, 2026
i asked Codex Cli to fix it :
What fixed it was not just renaming the .sqlite files. The missing piece was that Codex’s recovery flow expected this
directory to exist:
~/.codex/db-backups
In your case it did not exist, so “Back Up and Rebuild” failed with:
Recovery failed: ENOENT: no such file or directory, mkdir 'db-backups'
Here’s the exact summary you can post:
I was able to fix this by manually creating Codex’s missing backup directory and moving the active SQLite database
files out of the way.
The error dialog said Codex could not access its local SQLite database, and the recovery step failed with:
Recovery failed: ENOENT: no such file or directory, mkdir 'db-backups'What worked:
quinpeer commentedon Jun 22, 2026
Claude fixed my issue:
The dialog was misleading — your database was never actually corrupt (integrity_check and quick_check both returned ok). The real problem was a crash-looping process stack: a background codex app-server daemon and a codex-aar helper kept dying and respawning, each grabbing a lock on state_5.sqlite, so every relaunch failed to initialize the sqlite runtime. The in-app "Back Up and Rebuild" button couldn't help because it had its own bug (ENOENT … mkdir 'db-backups' — it tries to create that folder from a working directory that no longer exists).
What I did:
simontomkins commentedon Jul 6, 2026
Fully close the app, then in the terminal run
Then try restarting the app