2 bugs spotted when running Windows Desktop connects to opencode server in WSL: Shell runtime & Path Detection #5623

Open
opened 2026-02-16 17:54:52 -05:00 by yindo · 0 comments
Owner

Originally created by @qiansen1386 on GitHub (Jan 14, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Description

Background

We're running OpenCode with a Windows desktop client(1.18&1.19) connected to a WSL server. In this configuration, we've encountered critical issues with command execution:

Primary Issue

MCP activation fails with error:

ENOENT: no such file or directory, posix_spawn 'npx'

Root Cause Analysis

After investigation, we identified two fundamental issues:

  1. Shell Path Mismatch

    • All bash commands fail with ENOENT: no such file or directory, posix_spawn '/usr/bin/zsh'
    • The shell detection logic appears to have a bug in WSL environments
    • process.env.SHELL is set to /usr/bin/zsh, but this path is not accessible in the spawn context
    • This suggests OpenCode wasn't designed to properly handle WSL as a runtime environment
  2. Path Conversion Bug

    • Client (Windows) and server (WSL) cross-platform path detection is broken
    • Assume the correct WSL path is /mnt/d/qiansen1386
    • Client incorrectly sees: /mnt/d/qiansen1386/D:\qiansen1386
    • Windows paths are being redundantly appended to WSL paths

Impact

These issues make basic tool execution (shell, bash, npx) completely unusable in the WSL environment, effectively blocking MCP functionality and other command-dependent features.

We hope this provides enough context for you to investigate further.

Plugins

none

OpenCode version

1.19

Steps to reproduce

  1. Start the server in WSL using opencode serve --port *****
  2. Connect Desktop app to that port.
  3. Try activate MCP servers and ask the bot to run shell commands

Screenshot and/or share link

Image

Operating System

Windows 11 with WSL(Ubuntu 24)

Terminal

OpenCode Desktop, powershell in windows, zsh in linux

Originally created by @qiansen1386 on GitHub (Jan 14, 2026). Originally assigned to: @adamdotdevin on GitHub. ### Description ## Background We're running OpenCode with a **Windows desktop client(1.18&1.19)** connected to a **WSL server**. In this configuration, we've encountered critical issues with command execution: ### Primary Issue MCP activation fails with error: ``` ENOENT: no such file or directory, posix_spawn 'npx' ``` ### Root Cause Analysis After investigation, we identified **two fundamental issues**: 1. **Shell Path Mismatch** - All bash commands fail with `ENOENT: no such file or directory, posix_spawn '/usr/bin/zsh'` - The shell detection logic appears to have a bug in WSL environments - `process.env.SHELL` is set to `/usr/bin/zsh`, but this path is not accessible in the spawn context - This suggests OpenCode wasn't designed to properly handle WSL as a runtime environment 2. **Path Conversion Bug** - Client (Windows) and server (WSL) cross-platform path detection is broken - Assume the correct WSL path is `/mnt/d/qiansen1386` - Client incorrectly sees: `/mnt/d/qiansen1386/D:\qiansen1386` - Windows paths are being redundantly appended to WSL paths ### Impact These issues make basic tool execution (shell, bash, npx) completely unusable in the WSL environment, effectively blocking MCP functionality and other command-dependent features. We hope this provides enough context for you to investigate further. ### Plugins none ### OpenCode version 1.19 ### Steps to reproduce 1. Start the server in WSL using `opencode serve --port *****` 2. Connect Desktop app to that port. 3. Try activate MCP servers and ask the bot to run shell commands ### Screenshot and/or share link <img width="699" height="459" alt="Image" src="https://github.com/user-attachments/assets/5ecdd557-9a9e-4684-aa79-1bfabf65d412" /> ### Operating System Windows 11 with WSL(Ubuntu 24) ### Terminal OpenCode Desktop, powershell in windows, zsh in linux
yindo added the windowsbugweb labels 2026-02-16 17:54:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#5623