Skip to content

[Bug]: Windows: Claude Code not detected by OpenClaw, Gateway in restart loop after PATH workaround #76553

@sigrid-collab

Description

@sigrid-collab

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

OpenClaw fails to detect Claude Code on Windows even when Claude Code is correctly installed and visible in the user PATH. After installing the Gateway as an administrator and applying a PATH workaround in gateway.cmd, the Gateway enters a restart loop.

Steps to reproduce

Installed OpenClaw via the official PowerShell installer.
Ran openclaw setup — completed, but reported "Default model: not configured".
Installed Claude Code via npm install -g @anthropic-ai/claude-code.
Set PowerShell execution policy: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser (required to run claude.ps1).
Verified Claude Code works: claude --version returns 2.1.126.
Logged into Claude Code via browser — successful, "You're all set up for Claude Code".
Verified Claude Code is in PATH: where.exe claude returns:

C:\Users<user>\AppData\Roaming\npm\claude
C:\Users<user>\AppData\Roaming\npm\claude.cmd

Closed OpenClaw, opened a fresh PowerShell, re-ran openclaw setup. Setup completed successfully.
Started OpenClaw chat and ran list models. Output:

Default model: not configured
Codex: not found
Claude Code: not found
OpenAI key: not found
Anthropic key: not found
Gateway issues

Initial openclaw gateway install failed without admin rights:
Gateway service install failed: Error: schtasks create failed: ERROR: Toegang geweigerd (Access denied, NL locale).
Reran from elevated PowerShell — openclaw gateway install and openclaw gateway start both succeeded.
Gateway window opened and showed:

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...

Despite the running Gateway, OpenClaw chat still reported Gateway: not reachable at ws://127.0.0.1:18789 and Claude Code: not found.

Expected behavior

OpenClaw setup should detect a globally npm-installed Claude Code in %APPDATA%\npm on Windows.
The Scheduled Task Gateway should either inherit user PATH or have a documented way to register external CLI agents (Claude Code, Codex) when they are installed in the npm global prefix.

Actual behavior

?

OpenClaw version

OpenClaw version: 2026.4.29 (a448042)

Operating system

OpenClaw version: 2026.4.29 (a448042)

Install method

irm https://openclaw.ai/install.ps1 | iex

Model

OpenClaw version: 2026.4.29 (a448042)

Provider / routing chain

?

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Likely root cause
Windows Scheduled Tasks do not inherit interactive user PATH modifications. The npm global prefix %APPDATA%\npm is added to PATH on user login but is not visible to Scheduled Tasks, so the Gateway cannot resolve claude.cmd even though where.exe claude finds it in the user shell.

Impact and severity

Suggested fixes

Either probe known npm install locations explicitly during agent detection (e.g., %APPDATA%\npm, %LOCALAPPDATA%\npm).
Or expose a config key (e.g., models.claude.path or agents.claude.binary) so users can point OpenClaw to the binary directly without needing PATH magic.
Or document the Windows-specific PATH inheritance issue with a known workaround.

Additional information

Steps to reproduce

Installed OpenClaw via the official PowerShell installer.
Ran openclaw setup — completed, but reported "Default model: not configured".
Installed Claude Code via npm install -g @anthropic-ai/claude-code.
Set PowerShell execution policy: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser (required to run claude.ps1).
Verified Claude Code works: claude --version returns 2.1.126.
Logged into Claude Code via browser — successful, "You're all set up for Claude Code".
Verified Claude Code is in PATH: where.exe claude returns:

C:\Users<user>\AppData\Roaming\npm\claude
C:\Users<user>\AppData\Roaming\npm\claude.cmd

Closed OpenClaw, opened a fresh PowerShell, re-ran openclaw setup. Setup completed successfully.
Started OpenClaw chat and ran list models. Output:

Default model: not configured
Codex: not found
Claude Code: not found
OpenAI key: not found
Anthropic key: not found
Gateway issues

Initial openclaw gateway install failed without admin rights:
Gateway service install failed: Error: schtasks create failed: ERROR: Toegang geweigerd (Access denied, NL locale).
Reran from elevated PowerShell — openclaw gateway install and openclaw gateway start both succeeded.
Gateway window opened and showed:

[gateway] loading configuration…
[gateway] resolving authentication…
[gateway] starting...

Despite the running Gateway, OpenClaw chat still reported Gateway: not reachable at ws://127.0.0.1:18789 and Claude Code: not found.

Attempted workaround (failed)
Tried setting the Claude Code path via config:
openclaw config set models.claude-code.path "C:\Users<user>\AppData\Roaming\npm\claude.cmd"
Rejected with:
Error: Config validation failed: models: Unrecognized key: "claude-code"
The openclaw.json config has no models section at all — only agents, meta, and gateway.
Second workaround (caused loop)
Following a hypothesis that the Scheduled Task Gateway does not inherit user PATH, I added the following line at the top of C:\Users<user>.openclaw\gateway.cmd:
set PATH=%PATH%;C:\Users<user>\AppData\Roaming\npm
After openclaw gateway restart, the Gateway entered a restart loop and is no longer stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions