Skip to content

Windows: all plugin tools fail with 'spawn EINVAL' (spawn of swarm.cmd without shell:true) #207

Description

@danielacevedos

Environment: Windows 11, OpenCode 1.18.18 (desktop), opencode-swarm-plugin 0.63.2, Node v24.12.0.

Symptom: Every plugin tool (hivemind_*, hive_*, swarmmail_*, swarm_*, cass_*) fails with spawn EINVAL on Windows.

Root cause: the plugin wrapper spawns the CLI via child_process.spawn("swarm.cmd", args, { /* no shell:true */ }). Since Node 18.20.2 / 20.12.2 (CVE-2024-27980 mitigation), spawning .cmd/.bat without shell: true throws EINVAL. Repro:

node -e "require('child_process').spawn('swarm.cmd',['--version'],{stdio:'ignore'})"
# THROW: EINVAL spawn EINVAL

Impact: the entire swarm backend is unusable on Windows.

Local fix that works: replace import { spawn } from "child_process" with cross-spawn (drop-in, handles .cmd + arg quoting).

Related finding: running the CLI via Bun on this machine burns 100% CPU for minutes per invocation (parsing the ~437k-line dist/bin/swarm.js); invoking it with node directly (node dist/bin/swarm.js ...) starts in <1s and also avoids cmd.exe mangling shell metacharacters (>, &, |) inside --json payloads (observed corrupting a hivemind_store payload and redirecting stdout into a stray file). Consider documenting node as the runtime for the CLI on Windows, or shipping a smaller entry bundle.

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