tsx CLI fails in Codex sandbox with EPERM when creating IPC pipe
Open 💬 9 comments Opened Dec 19, 2025 by lastmjs
💡 Likely answer: A maintainer (davidgilbertson, contributor)
responded on this thread — see the highlighted reply below.
Summary
In the Codex CLI sandbox, the tsx CLI fails when it attempts to create its IPC pipe. The intent of this issue is to ensure tsx can run normally inside the sandbox (or that the sandbox provides a compatible fallback/permission), because tsx is a common TypeScript runner.
Environment
- Codex CLI sandbox (Linux; restricted IPC/socket permissions)
- Node.js v22.18.0
- tsx v4.21.0
Minimal reproducible example
mkdir -p /tmp/tsx-repro && cd /tmp/tsx-repro
npm init -y
npm i -D tsx typescript
mkdir -p src
cat > src/audit.ts <<'EOF'
console.log("ok")
EOF
npx tsx src/audit.ts
Actual result
tsx fails trying to create its IPC pipe:
Error: listen EPERM: operation not permitted /tmp/tsx-1000/204940.pipe
at Server.setupListenHandle [as _listen2] (node:net:1918:21)
at listenInCluster (node:net:1997:12)
at Server.listen (node:net:2119:5)
at .../node_modules/tsx/dist/cli.mjs:53:31537
at createIpcServer (.../node_modules/tsx/dist/cli.mjs:53:31515)
Expected result
tsx should run normally inside the Codex sandbox (or degrade gracefully if IPC is disallowed).
Workaround
node --import tsx src/audit.ts works in the same environment.
Notes
It looks like tsx always tries to create a named pipe under /tmp/tsx-UID/*.pipe. The Codex sandbox disallows listen() on that path. A Codex-level allowance for local IPC sockets, or a compatibility mode/flag to disable IPC, would fix this.
9 Comments
Not sure if this is related, but I get an EPERM error when trying to run tests. Running
!npm testin a codex session works fine. But if I ask codex to runnpm testthat fails.To reproduce this, in a repo with
esbuildinstalled from npm, create atesting.jsfile:In a codex session,
!node ./testing.jsshould work, but if you ask codex to run it, it will fail.I'm taking a look at this, the minimal code to reproduce the error:
Codex won't be able to run that, it gets EPERM thanks to the anonymous pipe.
A similar call with Python is fine, so the issue isn't anonymous pipes _per se_, it's something about the _way_ that Node/libuv creates them, and how that interacts with the Windows sandbox setup (the non-elevated one).
I think this should be fixed by https://github.com/openai/codex/pull/8280, not released yet (as of 0.77.0)
@davidgilbertson, the PR you mentioned is specific to Windows, so it won't have any effect on Linux.
Ah, of course, I forgot that OP's issue was linux.
I've since learnt that #8280 doesn't fix the issue I was having either. I'm sure this is known already, but in case it isn't (the code doesn't allude to it), the issue with pipes is as follows (particularly in the case I posted above):
libuvto create the pipe, and it creates a named pipe (as opposed to an anonymous pipe).libuvthen goes on to requestWRITE_DACpermissions on the pipe (maybe worth raising this as an issue with them for the long term?).libuv).But the recent change to remember to run a command without the sandbox seems to work well. (Although I've noticed this is opaque to the agent, so if you ask it if it ran the command in a sandbox it will say yes.)
Are there any known workarounds for this issue, so I can enable my sandboxed codex to run my vitest tests without crashing in the EPERM issue?
I suspect I'm hitting the same issue in a different context. Here's a fully standalone test case:
sandbox_unix_bind_test.c
It compiles, it runs just fine outside the sandbox, and it really ought to work inside the sandbox as well.
I may have a related problem - I asked
codex clito introspect on why a script succeeds when I run it in the terminal, but fails when codex tui launches the same command.Codex's report contains a lot of similar verbage -
spawnand empty pipes.Where I would particularly hightlight this part:
---
Chewed through a solid 40% of its context window to work the problem, but the report it got me is better researched and argued than many I've seen human engineers produce - it suggested I report the problem, and I found this issue when I was looking to see if somebody already had.
Just a note that this is appears to be cross-platform as it is an issue for the Codex app on macOS as well.