anomalyco / anomalyco/opencode

Desktop Windows: Open in VS Code fails with spawn Code.exe EACCES

Open
#49,967 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

On OpenCode Desktop for Windows, Open in → VS Code fails with this toast:

Request failed
Error invoking remote method 'open-path':
Error: spawn C:\Program Files\Microsoft VS Code\Code.exe EACCES

This is NOT the old [object Promise] ENOENT bug (#26814, #26928, #27432 — closed/fixed). The path now resolves correctly, but spawning the resolved exe fails with EACCES.

Verified the failure happens at OS level, not just in the toast:

  • node:child_process spawnSync("C:\Program Files\Microsoft VS Code\Code.exe", ["--version"])EACCES (reproduced multiple times)
  • Invoking the same exe directly from PowerShell also fails silently
  • ACLs are normal (BUILTIN\Users: RX), no Zone.Identifier (MOTW) stream, not a symlink/reparse point
  • The VS Code install itself is healthy (current layout with versioned subdirectories) and code / code.cmd from a terminal works fine

Root cause (from reading dev): resolveWindowsAppPath() in packages/desktop/src/main/apps.ts parses code.cmd and extracts the Code.exe path, then the open-path handler in packages/desktop/src/main/ipc.ts runs execFile(resolvedExe, [projectPath]) with no shell and no fallback:

const [cmd, args] =
  process.platform === "darwin" ? (["open", ["-a", app, path]] as const) : ([app, [path]] as const)
execFile(cmd, args, (err) => (err ? reject(err) : resolve()))

On this machine that direct spawn returns EACCES, while launching via the code.cmd shim works.

Suggested direction: when the resolver lands on an exe extracted from a .cmd/.bat shim, launch the shim itself (e.g. via cmd.exe /c / shell: true) instead of the extracted exe — or fall back to it when the direct spawn fails with EACCES.

Plugins

None

OpenCode version

Desktop 1.18.31 (Windows x64)

Steps to reproduce
  1. Open OpenCode Desktop on Windows with any project
  2. Session header → "Open in" → VS Code
  3. Observe the spawn ... Code.exe EACCES toast
Screenshot and/or share link
Image
Operating System

Windows 11 Pro Education, 25H2, build 26200.9457

Terminal

Windows PowerShell 5.1.26100.9444

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with resolveWindowsAppPath() in packages/desktop/src/main/apps.ts, then read the open-path handler in packages/desktop/src/main/ipc.ts. Reproduce the Windows EACCES behavior and compare direct executable launching with the code.cmd shim. Done means Open in → VS Code works for the reported Windows installation without regressing the existing path resolution behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.