[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

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 ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗