Skip to content

Codex CLI can't access any file #3477

Closed

Description

@MartinKnopf

What version of Codex is running?

codex-cli 0.34.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.6.0 x86_64 i386

What steps can reproduce the bug?

  1. Install codex cli: npm i -g @openai/codex
  2. Login with ChatGPT subscription
  3. Create dummy README.md: echo "# Test" > README.md
  4. List directory contents:
    Image
  5. Let codex summarize the file: codex --yolo "summarize README.md"

What is the expected behavior?

A summary of the file.

What do you see instead?

Image

Additional information

I already deleted ~/.codex and reinstalled codex. Codex is able to create files and in the same session can read those files. But in a new session it can't read those files again.

Activity

  1. looper200 commented on Sep 11, 2025

    @looper200

    also its can't suggest files using @

  2. MartinKnopf commented on Sep 12, 2025

    @MartinKnopf
    Author

    also its can't suggest files using @

    Thanks for mentioning. Fuzzy search using @ works in interactive mode. But it can't read the files that I point it to.

  3. icianfi commented on Sep 13, 2025

    @icianfi

    same issue here, seems sandbox limitation.

  4. 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.

  5. MartinKnopf commented on Sep 15, 2025

    @MartinKnopf
    Author

    Thank you @minhluuquang! Your fix worked for me.

  6. Umupa commented on Oct 26, 2025

    @Umupa

    I ran into a similar issue and was able to resolve it by integrating the filesystem MCP tool. Here’s the exact configuration that worked for me:

    ~/.codex/config.toml

    [mcp_servers.filesystem]
    command = "npx"
    args = ["-y", "@modelcontextprotocol/server-filesystem", "/your/project/path"]
    

    With this setup, the Codex CLI can properly access and read files from the specified directory, effectively resolving the file access problem.

    Feel free to replace "your/project/path" with the actual path to your project. Hope this helps!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions