Codex runs git add and git commit in parallel, causing index.lock errors
Resolved 💬 2 comments Opened Apr 11, 2026 by jinjor Closed Apr 11, 2026
What version of Codex CLI is running?
codex-cli 0.120.0
What subscription do you have?
ChatGPT Plus
Which model were you using?
gpt-5.4
What platform is your computer?
Darwin 25.3.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
VSCode
What issue are you seeing?
When Codex tried to commit changes, the commit failed with a Git index.lock error.
What steps can reproduce the bug?
- Open a Git repository with modified files.
- Ask Codex to commit the current changes.
- Codex invokes
git add ...andgit commit -m "..."in parallel. - The
git commitcommand fails with anindex.lockerror.
What is the expected behavior?
Codex should run Git write operations sequentially, not in parallel.
For example:
git add- wait for completion
git commit- wait for completion
git push
Additional information
In my experience, this happens frequently.
In this case, the lock file was removed automatically, so retrying the commit succeeded. Because of that, this is not always a blocking problem in practice, but it does interrupt the workflow and produces avoidable Git errors.
The error was:
fatal: Unable to create '/path/to/repo/.git/index.lock': File exists.
Another git process seems to be running in this repository...This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗