claude-code - 💡(How to fix) Fix Cowork: GitHubPrManager spawns local `gh` with remote-session cwd, fails with misleading ENOENT

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…

When working in a Cowork (remote SSH) session, Claude desktop's PR/CI panel reports "CI checks unavailable" for every PR. ~/Library/Logs/Claude/main.log shows:

[GitHubPrManager] Failed to get PR state for branch:
Failed to spawn /opt/homebrew/bin/gh: spawn /opt/homebrew/bin/gh ENOENT

The error message blames the binary path, but /opt/homebrew/bin/gh exists, is executable, and is authenticated. The real failure is the cwd option being passed to child_process.spawn.

Error Message

The error message blames the binary path, but /opt/homebrew/bin/gh exists, is executable, and is authenticated. The real failure is the cwd option being passed to child_process.spawn. node -e 'require("child_process").spawn("/opt/homebrew/bin/gh", ["--version"], {cwd: "/path/that/does/not/exist/locally"}).on("error", e => console.log(e.message, e.code))' Identical error format to the one in main.log.

Root Cause

A Cowork session's working directory is a remote Linux path, e.g.

Working directory: /home/eo/src/airshelf/.claude/worktrees/charming-wing-4298ff

(visible in ~/Library/Logs/Claude/ssh.log for every RemoteProcess spawn).

The desktop-side GitHubPrManager then tries to populate the PR/CI panel by calling child_process.spawn('/opt/homebrew/bin/gh', [...], { cwd: <that remote path>, env, timeout }) — but on the local macOS host. The remote Linux path doesn't exist on the Mac, posix_spawn fails to chdir into it, and Node surfaces the failure as ENOENT on the binary path, which is misleading enough that users (and the bot in #57859) chase the wrong fix (PATH, LSEnvironment, gh auth, code-signing).

Code Example

[GitHubPrManager] Failed to get PR state for branch:
Failed to spawn /opt/homebrew/bin/gh: spawn /opt/homebrew/bin/gh ENOENT

---

Working directory: /home/eo/src/airshelf/.claude/worktrees/charming-wing-4298ff

---

node -e 'require("child_process").spawn("/opt/homebrew/bin/gh", ["--version"], {cwd: "/path/that/does/not/exist/locally"}).on("error", e => console.log(e.message, e.code))'
# → spawn /opt/homebrew/bin/gh ENOENT ENOENT
RAW_BUFFERClick to expand / collapse

Summary

When working in a Cowork (remote SSH) session, Claude desktop's PR/CI panel reports "CI checks unavailable" for every PR. ~/Library/Logs/Claude/main.log shows:

[GitHubPrManager] Failed to get PR state for branch:
Failed to spawn /opt/homebrew/bin/gh: spawn /opt/homebrew/bin/gh ENOENT

The error message blames the binary path, but /opt/homebrew/bin/gh exists, is executable, and is authenticated. The real failure is the cwd option being passed to child_process.spawn.

Root cause

A Cowork session's working directory is a remote Linux path, e.g.

Working directory: /home/eo/src/airshelf/.claude/worktrees/charming-wing-4298ff

(visible in ~/Library/Logs/Claude/ssh.log for every RemoteProcess spawn).

The desktop-side GitHubPrManager then tries to populate the PR/CI panel by calling child_process.spawn('/opt/homebrew/bin/gh', [...], { cwd: <that remote path>, env, timeout }) — but on the local macOS host. The remote Linux path doesn't exist on the Mac, posix_spawn fails to chdir into it, and Node surfaces the failure as ENOENT on the binary path, which is misleading enough that users (and the bot in #57859) chase the wrong fix (PATH, LSEnvironment, gh auth, code-signing).

Reproducer (no Claude needed)

node -e 'require("child_process").spawn("/opt/homebrew/bin/gh", ["--version"], {cwd: "/path/that/does/not/exist/locally"}).on("error", e => console.log(e.message, e.code))'
# → spawn /opt/homebrew/bin/gh ENOENT ENOENT

Identical error format to the one in main.log.

Suggested fix

Pick one:

  • (a) Preferred: for Cowork sessions, run gh over SSH against the remote cwd. The remote already has the repo, the branch, and (in this user's case) an authenticated gh. PR state is naturally repo-local; round-tripping to the local host adds nothing.
  • (b) Resolve the session cwd to a host-local equivalent before the local spawn — but this only works if the user happens to have the same repo cloned locally at a matching path. Brittle.
  • (c) At minimum, detect a non-existent cwd before spawning and surface a clear panel message ("CI checks not available in remote sessions" or "Working directory not found on host") instead of letting the ENOENT bubble up. This would have saved hours of mis-diagnosis.

Versions

  • Claude.app: 1.8089.1
  • macOS: 26.x (Apple Silicon)
  • Cowork remote: Linux (Ubuntu), reached via SSH
  • gh: 2.92.0 (Homebrew, /opt/homebrew/bin/gh), keyring-authed

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

claude-code - 💡(How to fix) Fix Cowork: GitHubPrManager spawns local `gh` with remote-session cwd, fails with misleading ENOENT