Skip to content

Can't read/edit files #3306

Closed
Closed

Description

@adek

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

Activity

  1. added
    bug
    on Sep 8, 2025
  2. jif-oai commented on Sep 8, 2025

    @jif-oai
    Contributor

    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: )
  3. adek commented on Sep 8, 2025

    @adek
    Author

    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"

  4. self-assigned this
    on Sep 8, 2025
  5. adek commented on Sep 9, 2025

    @adek
    Author

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

  6. minhluuquang commented on Sep 13, 2025

    @minhluuquang

    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.

  7. d-klotz commented on Sep 19, 2025

    @d-klotz

    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.

  8. michaelfortunato commented on Oct 24, 2025

    @michaelfortunato
  9. added
    tool-calls
    on Nov 9, 2025
  10. etraut-openai commented on Dec 23, 2025

    @etraut-openai
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugtool-calls

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions