preview_start always fails with 'No such file or directory' regardless of launch.json config

Resolved 💬 3 comments Opened Apr 6, 2026 by macchrizze Closed Apr 7, 2026

Bug Report: Claude Code preview_start MCP tool always fails with "No such file or directory"

Summary

The mcp__Claude_Preview__preview_start tool in Claude Code fails with Failed to spawn process: No such file or directory regardless of what's in .claude/launch.json, including configurations that use standard system binaries that definitely exist.

Environment

  • macOS 25.3.0 (Darwin)
  • Claude Code (powered by claude-opus-4-6[1m])
  • Homebrew at /opt/homebrew/bin
  • Node v25.8.1 installed at /opt/homebrew/Cellar/node/25.8.1_1/bin/node

Reproduction

Create a minimal .claude/launch.json that uses a binary that definitely exists:

{
  "version": "0.0.1",
  "configurations": [
    {
      "name": "dev",
      "runtimeExecutable": "/bin/ls",
      "runtimeArgs": ["/tmp"],
      "port": 8080,
      "autoPort": false
    }
  ]
}

Then call preview_start with name: "dev".

Expected: Either server starts or a meaningful error (e.g. "this isn't a server")
Actual: Failed to start preview server: Failed to spawn process: No such file or directory

/bin/ls and /tmp both definitely exist:

$ ls -la /bin/ls /tmp
-rwxr-xr-x  1 root  wheel  154624 Feb 25 04:41 /bin/ls
lrwxr-xr-x@ 1 root  wheel      11 Feb 25 04:41 /tmp -> private/tmp

Other configurations tried (all fail with the same error)

  1. npm / ["run", "dev"] (npm is at /opt/homebrew/bin/npm)
  2. /opt/homebrew/bin/npm (absolute path)
  3. /opt/homebrew/Cellar/node/25.8.1_1/bin/node / ["./node_modules/vite/bin/vite.js"]
  4. /opt/homebrew/Cellar/node/25.8.1_1/bin/node / ["/absolute/path/to/vite.js"]
  5. /bin/bash / ["-c", "...full command..."]
  6. /usr/bin/env / ["node", "vite.js"]
  7. /bin/bash / ["./wrapper.sh"] (shell wrapper with #!/bin/bash shebang)

Every single one fails immediately with "Failed to spawn process: No such file or directory".

Workaround

Running the exact same command via the Bash tool in the background works perfectly:

/opt/homebrew/Cellar/node/25.8.1_1/bin/node ./node_modules/vite/bin/vite.js

→ Server starts on port 8080, app serves fine.

Impact

  • preview_start is completely unusable in this environment.
  • Claude has to use Bash + run_in_background: true as a workaround.
  • Worse: the Stop hook in the harness expects the preview server to be managed by preview_start and complains every time code is edited, even when a manually-started dev server is running.

Hypothesis

It looks like preview_start either (a) has a hard-coded PATH that doesn't include /opt/homebrew/bin, or (b) passes the runtimeExecutable/runtimeArgs to a spawn call with a malformed cwd or environment, and the ENOENT is coming from a chdir() step rather than the exec() step. The error message misleadingly says "Failed to spawn" no matter what the actual underlying error was.

Suggested Fix

  1. Make the error message distinguish between "binary not found", "cwd doesn't exist", and "interpreter for shebang not found".
  2. Accept a cwd field in launch.json (or at least default to the project root where .claude/launch.json lives).
  3. When spawning via shell, inherit the user's login PATH rather than a minimal PATH that's missing /opt/homebrew/bin and similar.

View original on GitHub ↗

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