Skip to content

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

Closed

Description

@qiansen1386

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

Activity

  1. github-actions commented on Jan 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or related to existing issues. Please check:

    The core issues you've identified (shell path mismatch and path conversion bugs) align with multiple existing WSL-related problems. The cross-platform path detection issue especially mirrors #6460.

    Feel free to ignore if none of these address your specific case.

  2. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwebRelates to opencode on web / desktopwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions