openclaw - 💡(How to fix) Fix Windows native: shell env fallback failed with spawnSync /bin/sh ENOENT [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

In src/infra/shell-env.ts, the probeLoginShellEnv function attempts to execute /bin/sh to probe the login shell environment. On Windows, this shell doesn't exist, causing the ENOENT error.

Root Cause

Root Cause In src/infra/shell-env.ts, the probeLoginShellEnv function attempts to execute /bin/sh to probe the login shell environment. On Windows, this shell doesn't exist, causing the ENOENT error.

Fix Action

Fixed

Code Example

[openclaw] shell env fallback failed: spawnSync /bin/sh ENOENT

---

function probeLoginShellEnv(params: {
  env: NodeJS.ProcessEnv;
  timeoutMs?: number;
  exec?: typeof execFileSync;
  platform?: NodeJS.Platform;
}): LoginShellEnvProbeResult {
  const platform = params.platform ?? process.platform;
  if (platform === "win32") {
    return { ok: true, shellEnv: new Map() };
  }
  // ... rest of the function
}
RAW_BUFFERClick to expand / collapse

Describe the bug When running OpenClaw 2026.5.19 on native Windows (not WSL2), the following warning appears during startup:

[openclaw] shell env fallback failed: spawnSync /bin/sh ENOENT

To Reproduce Steps to reproduce the behavior:

  1. Install OpenClaw 2026.5.19 on native Windows
  2. Run openclaw or openclaw status
  3. See the warning about /bin/sh ENOENT

Expected behavior OpenClaw should detect Windows platform and skip the shell env fallback that relies on /bin/sh, which doesn't exist on Windows.

Environment:

  • OS: Windows 10/11 (native, not WSL2)
  • OpenClaw version: 2026.5.19

Root Cause In src/infra/shell-env.ts, the probeLoginShellEnv function attempts to execute /bin/sh to probe the login shell environment. On Windows, this shell doesn't exist, causing the ENOENT error.

While getShellPathFromLoginShell already has a Windows platform check, probeLoginShellEnv (called by loadShellEnvFallback) does not have this check.

Proposed Fix Add a Windows platform check at the beginning of probeLoginShellEnv function:

function probeLoginShellEnv(params: {
  env: NodeJS.ProcessEnv;
  timeoutMs?: number;
  exec?: typeof execFileSync;
  platform?: NodeJS.Platform;
}): LoginShellEnvProbeResult {
  const platform = params.platform ?? process.platform;
  if (platform === "win32") {
    return { ok: true, shellEnv: new Map() };
  }
  // ... rest of the function
}

Additional context Related to the Windows native support improvements mentioned in the 5.19 release notes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Windows native: shell env fallback failed with spawnSync /bin/sh ENOENT [2 pull requests]