Skip to content

Agent fails to spawn claude on Windows when the CLI is installed via npm (.ps1/.cmd shim) #63

Description

@mthelm85

On Windows, an npm-installed Claude Code CLI provides claude.ps1 / claude.cmd shims on PATH rather than an .exe. Kaimon's agent service spawns `claude -p ...` directly, and libuv/Base.run only resolves real executables — so opening the agent fails with:

Error opening agent: IOError: could not spawn setenv(`claude -p --input-format stream-json ...`): no such file or directory (ENOENT)

...even though claude --version works fine in the user's shell.

Installing the native build (irm https://claude.ai/install.ps1 | iex, which drops claude.exe into ~/.local/bin) fixes it.

Suggestions (any subset):

  • Detect the situation: if spawning fails and Sys.which("claude") === nothing while a claude.cmd/claude.ps1 exists on PATH, raise a clear error telling the user to install the native CLI.
  • Or spawn via cmd /c claude ... on Windows when only a shim is present.
  • Docs: note that on Windows the native installer is required for the agent.

Also worth noting: the ENOENT error message currently dumps the entire environment block (including any API keys in the user's environment) into the UI — trimming that would avoid accidental secret leaks when users paste errors into issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions