database is locked

Open 💬 3 comments Opened Jul 5, 2026 by nuliknol

What version of Codex CLI is running?

v0.142.5

What subscription do you have?

PRO 20x

Which model were you using?

all of them

What platform is your computer?

Linux Ubuntu

What terminal emulator and version are you using (if applicable)?

xterm-256color

Codex doctor report

What issue are you seeing?

I have many agents with the same CODEX_HOME coding in parallel. But out of the sudden I ran into a race condition (at starting a new codex session):

Codex couldn't start because another Codex process is using its local data.
Quit any other copies of Codex that may still be running, then try again.
Technical details:
  Location: /home/mf/codex-cli/state_5.sqlite
  Cause: failed to initialize state runtime at /home/mf/codex-cli: failed to open state DB at /home/mf/codex-cli/state_5.sqlite: error returned from database: (code: 5) database is locked: error returned from database: (code: 5) database is locked: (code: 5) database is locked
ERROR: failed to initialize sqlite local db at /home/mf/codex-cli/state_5.sqlite: failed to initialize state runtime at /home/mf/codex-cli: failed to open state DB at /home/mf/codex-cli/state_5.sqlite: error returned from database: (code: 5) database is locked: error returned from database: (code: 5) database is locked: (code: 5) database is locked

Could you please add the PID of blocking process? This message doesn't help, I need to know which process is blocking so I can kill it. Also, locks should be timed out automatically if there is no running queries. If the process has the DB locked, and it is not alive, you should drop the connection and put the DB in unlocked state

What steps can reproduce the bug?

Race condition, not reproducible

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗