Bug Description
preview_start consistently fails with EPERM: operation not permitted, uv_cwd when attempting to start a dev server. The subprocess spawned by the preview tool cannot resolve its working directory, even though the CWD is valid and accessible from the shell.
Environment
- OS: macOS (Darwin 25.2.0)
- Node.js: v22.17.0 (via nvm)
- Claude Code: latest (CLI)
- Shell: zsh
Steps to Reproduce
- Navigate to a Next.js project directory
- Ensure
.claude/launch.json exists with a valid config:
{
"version": "0.0.1",
"configurations": [
{
"name": "dev",
"runtimeExecutable": "npx",
"runtimeArgs": ["next", "dev"],
"port": 3000,
"autoPort": true
}
]
}
- Use
preview_start with name: "dev"
Expected Behavior
The dev server starts and preview tools become available.
Actual Behavior
The subprocess immediately crashes with:
Error: EPERM: operation not permitted, uv_cwd
at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:142:28)
...
Troubleshooting Done
- Verified CWD exists and is accessible (
pwd, ls -la both work)
- Verified
npx is available and functional (which npx, npx --version)
- Tried using
node_modules/.bin/next directly instead of npx — same error
- The error occurs before any project code runs — Node.js itself cannot call
process.cwd() in the spawned subprocess
- Running
npx next dev directly from the same shell works fine
Analysis
The issue appears to be in how the preview infrastructure spawns child processes. The subprocess inherits a CWD context that is stale or has restricted permissions, even though the parent process's CWD is valid. This is a process-management issue in the preview tool, not a project configuration problem.
Bug Description
preview_startconsistently fails withEPERM: operation not permitted, uv_cwdwhen attempting to start a dev server. The subprocess spawned by the preview tool cannot resolve its working directory, even though the CWD is valid and accessible from the shell.Environment
Steps to Reproduce
.claude/launch.jsonexists with a valid config:{ "version": "0.0.1", "configurations": [ { "name": "dev", "runtimeExecutable": "npx", "runtimeArgs": ["next", "dev"], "port": 3000, "autoPort": true } ] }preview_startwithname: "dev"Expected Behavior
The dev server starts and preview tools become available.
Actual Behavior
The subprocess immediately crashes with:
Troubleshooting Done
pwd,ls -laboth work)npxis available and functional (which npx,npx --version)node_modules/.bin/nextdirectly instead ofnpx— same errorprocess.cwd()in the spawned subprocessnpx next devdirectly from the same shell works fineAnalysis
The issue appears to be in how the preview infrastructure spawns child processes. The subprocess inherits a CWD context that is stale or has restricted permissions, even though the parent process's CWD is valid. This is a process-management issue in the preview tool, not a project configuration problem.