[Bug] Leading `/` stripped from absolute path, followed by `ENOENT` crash due to attempt to access non-existent file.

Resolved 💬 3 comments Opened Apr 19, 2025 by emcd Closed Aug 7, 2025
💡 Likely answer: A maintainer (jonchurch, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.1.2504172351

Which model were you using?

o4-mini

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Ask the assistant to read a file at an absolute path. Its tool call strips the leading / and then crashes the entire codex process when it cannot open the resulting relative path, which does not exist.

!Image

What is the expected behavior?

No stripping of filesystem root from an absolute path. If there are security concerns about reading absolute paths, then a warning should be issued.

Also, when an I/O operation fails, it should not crash the entire process.

What do you see instead?

A crash; see screenshot above or text below:

node:internal/fs/promises:638
  return new FileHandle(await PromisePrototypeThen(
                        ^

Error: ENOENT: no such file or directory, open 'mnt/d/Downloads/aiwb-openai-tools-success.PNG'
    at async open (node:internal/fs/promises:638:25)
    at async Object.readFile (node:internal/fs/promises:1242:14)
    at async WA (file:///home/me/.local/share/npm-packages/lib/node_modules/@openai/codex/dist/cli.js:271:8860)
    at async file:///home/me/.local/share/npm-packages/lib/node_modules/@openai/codex/dist/cli.js:271:12843 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'mnt/d/Downloads/aiwb-openai-tools-success.PNG'
}

Node.js v22.14.0

Additional information

_No response_

View original on GitHub ↗

3 Comments

jonchurch contributor · 1 year ago

~dupe of # 330~

Actually no maybe not

emcd · 1 year ago
~dupe of # 330~ Actually no maybe not

@jonchurch : Yeah, it's not. I read that one before posting this issue. That one is about discovery on startup. This one is about a tool call (I suspect) causing a crash. But, thanks for being on the lookout.

codex-maintainers · 1 year ago

Thank you for the feedback! Please try the latest version of Codex CLI. If the issue persists, we encourage you to report it or contribute to the codex-rs/ implementation as we're focusing on the native Rust version. You can find more details in our project update.