Skip to content

Windows: app-embedded terminal fails to launch claude-code ("claude" .cmd/.ps1 shim not spawnable via CreateProcessW, os error 193) #314

Description

@akokuro369-png

Environment

  • OS: Windows 11
  • agmsg app version: 0.1.3 (x64-setup.exe)
  • claude-code installed via npm install -g @anthropic-ai/claude-code

Bug

Opening an agent's dedicated terminal tab (e.g. clicking "Ami" in the sidebar,
type=claude-code) fails immediately with:

"claude" の起動に失敗しました: CreateProcessW `"C:\Users\<user>\AppData\Roaming\npm\claude" "/agmsg actas Ami\"\0"` in cwd `Some("C:\Users\<user>\0")` failed: %1 は有効な Win32 アプリケーションではありません。 (os error 193)

Root cause (as far as I can tell)

On Windows, npm creates three files for a globally-installed CLI in
%APPDATA%\npm\:

  • claude — extensionless POSIX shell script (shebang), used by Git Bash / WSL
  • claude.cmd — batch shim, used by cmd.exe / PowerShell
  • claude.ps1 — PowerShell shim

The actual native binary lives at
%APPDATA%\npm\node_modules\@anthropic-ai\claude-code\bin\claude.exe.

The app appears to resolve claude from PATH by taking the first
exact-name match without trying .cmd/.exe/PATHEXT, then passes that
path straight to CreateProcessW. Since the resolved file is a shell
script with a shebang (not a PE image), Windows returns error 193
("not a valid Win32 application").

I copied the native claude.exe into %APPDATA%\npm\claude.exe
(same directory) as a test — this did not change the behavior, so the
resolution isn't just "first .exe found" either; it seems to
specifically grab the bare extensionless claude file every time.

Workaround

None found that doesn't risk breaking Git Bash's claude invocation
(which needs the extensionless shim). Currently using the CLI
(~/.agents/skills/agmsg/scripts/) to actas the agent first, then using
the desktop app only for the message/history view — that works fine
(the shared sqlite DB and monitor pick up messages correctly).

Suggested fix

On Windows, prefer claude.cmd (or resolve via PATHEXT / spawn through
cmd.exe /c) when launching a claude-code type agent's terminal,
instead of a raw extensionless match.

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