Can't read/edit files

Resolved 💬 7 comments Opened Sep 8, 2025 by adek Closed Dec 23, 2025
💡 Likely answer: A maintainer (jif-oai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.30.0

Which model were you using?

gpt5-medium

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

I'd like to use codex for my project. But I get strange issues that codex can't read/edit files.

While running I see plenty of errors like that:

` Explored
└ List ls -la
Search rg --files
Search find . -maxdepth 3 -type d -print

• Ran cat -n README.md | sed -n '1,120p'
└ bash: cat: command not found
bash: sed: command not found
`

Tried installing codex from npm and brew. No changes. When I'm asking codex to chcek it - sometimes it's using python to do it.

I checked my shell options - ls, grep, sed - this should be available. Gemini or Claude CLI have no issues here.

I changed approval to full - same. Codex is just giving me code to paste and saying:

If you want, I can apply this change directly, but my current environment can’t read files. Paste the body of DashboardView here, or grant me a quick project scan, and I’ll patch it for you.
Token usage: total=10046 input=4202 (+ 55936 cached) output=5844 (reasoning 4864)

What is the expected behavior?

Codex should read/edit files.

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

7 Comments

jif-oai contributor · 10 months ago

Thanks for your message. Can you provide me the logs that you have on those sessions ?
For this:

  1. export RUST_LOG="warn,codex_core=trace,codex_tui=trace"
  2. Logs are located in ~/.codex/log/codex-tui.log if you are using a terminal
  3. Send them to me (you can do this in private if you prefer: <REMOVED>)
adek · 10 months ago

OK. I turned on logs. But I need to wait for these errors.
What changed.

After asking for summary about my codebase - codex started editing files by ... using workaround with python scripts. It's now instead of LS, SED using small python scripts to do that.

But I was able to get some errors with new session and new task (just for this case).

` Proposed Command
└ /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | head -n 50

✔ You approved codex to run /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard... this time

Ran /usr/bin/grep -RIN "card|Card|cardsOrder|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | head -n 50
└ bash: head: command not found
grep: invalid option -- N
usage: grep [-abcdDEFGHhIiJLlMmnOopqRSsUVvwXxZz] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]

• Proposed Command
└ /usr/bin/grep -RIsn "card\|Card\|cardsOrder\|order" XXX/SUI/Features/Dashboard XXX/SUI/Common | /usr/bin/sed -n '1,80p'`

Now - grep started working because codex told me that it is starting to use absolute paths for commands. But ask you can see - the issue is with "head"

adek · 10 months ago

I've sent you mail with new logs. Same issue with 0.31.0

minhluuquang · 10 months ago

For anyone running into this problem, here is my case

The Codex cli always runs commands by calling:

bash -lc "your command"

(for example, bash -lc "ls -la" or bash -lc "pwd").

If you’re using fish (or any shell other than bash) as your main shell, this can break if your ~/.bash_profile or ~/.bashrc forces bash to immediately exec into another shell. In my case, my ~/.bash_profile looked like this:

export PATH="${PATH}:${HOME}/.local/bin"
export SHELL=/bin/zsh
exec /bin/zsh -l

Because of the exec /bin/zsh -l, bash never actually ran the command — it just switched over to zsh and stopped, causing empty output for codex cli

Fix:
Check your ~/.bash_profile or ~/.bashrc for any lines like exec /bin/zsh -l (or exec fish -l) and remove them. After I removed that line, Codex worked perfectly again, even though my main shell is still fish.

d-klotz · 10 months ago

Codex is stuck for me when I run the /init command.

I only get this:

Exploring
└ List ls

And it keeps there forever.
I'm using Zsh as terminal.

michaelfortunato · 8 months ago
For anyone running into this problem, here is my case The Codex cli always runs commands by calling: bash -lc "your command" (for example, bash -lc "ls -la" or bash -lc "pwd"). If you’re using fish (or any shell other than bash) as your main shell, this can break if your ~/.bash_profile or ~/.bashrc forces bash to immediately exec into another shell. In my case, my ~/.bash_profile looked like this: export PATH="${PATH}:${HOME}/.local/bin" export SHELL=/bin/zsh exec /bin/zsh -l Because of the exec /bin/zsh -l, bash never actually ran the command — it just switched over to zsh and stopped, causing empty output for codex cli Fix: Check your ~/.bash_profile or ~/.bashrc for any lines like exec /bin/zsh -l (or exec fish -l) and remove them. After I removed that line, Codex worked perfectly again, even though my main shell is still fish.

Thank you @minhluuquang!. I was doing this in my .profile which caused it.

etraut-openai contributor · 6 months ago

This bug report is very old and likely stale. Closing.