Skip to content

Windows Desktop passes WSL UNC paths to a Linux server, causing HTTP 500 errors and persistent startup crashes #52205

Closed

Description

@MTVNAMT

Description

I am using OpenCode Desktop on Windows 11, connected to an OpenCode v2 server running inside WSL2.

When I add a WSL project through the desktop app, it opens the native Windows folder picker. Selecting a folder inside WSL returns a Windows UNC path, such as:

\\wsl.localhost\UbuntuD\home\tmbv\src\Admin.Net

The desktop app passes this path directly to the Linux server instead of converting it to:

/home/tmbv/src/Admin.Net

The Linux server then fails to resolve the directory. The project may appear in the desktop UI, but its conversation history and Git information cannot be loaded. Requests return HTTP 500, and the desktop app can enter a fatal error screen.

Environment

  • OS: Windows 11
  • Backend: WSL2, distribution named UbuntuD
  • WSL OpenCode CLI/server:

Activity

  1. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

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

    • #19473: Desktop sends UNC paths to a WSL-hosted server, producing invalid Linux workdirs and failed tool calls.
    • #34255: A POSIX server resolves Windows/UNC directory hints against its working directory.
    • #33550: Desktop sends Windows-native project paths to a WSL server, causing session-list errors.
  2. kenden commented on Oct 1, 2026

    @kenden

    I can reproduce, with OpenCode Windows Desktop v2.0.20 on Windows 11 and opencode cli v2.0.20 inside of WSL 3.0.1.0.

    How to reproduce

    Workaround

    Connect with the IP address of the WSL machine instead.
    Note that then, starting the server on 127.0.0.1 is not going to work.

  3. Embiggenerd commented on Oct 4, 2026

    @Embiggenerd

    I think this is expected behavior. Windows consumers of this app probably never running the server in WSL. So this is a development environment issue. A policy such as, run all the things in windows all the time for dev makes sense because that mimics a windows user experience.

    To go down the route of doing X in windows but Y in Linux opens up a large bug surface area that will take up dev time.

  4. Embiggenerd commented on Oct 5, 2026

    @Embiggenerd

    I've dug deeper and it looks like this is a documented setup (packages/web/src/content/docs/windows-wsl.mdx). I think the use case for running a server via the CLI is to connect the desktop app remotely. If you do this locally, the app uses the native file picker, which returns windows paths in this case..

    I think the right solution is to use the in-app picker for every server except the one the app started itself. This will fix the 500 error this issue is targeting.

    I've got a working solution running locally and have tested it.

    PR #53628 is submitted.

  5. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the report, and thanks @kenden for the steps. I couldn't run the Windows desktop app here, but I confirmed the parts I could:

    • With opencode serve v2.0.20 on Linux, asking for project/git info with the path \\wsl.localhost\UbuntuD\home\tmbv\src\Admin.Net returns HTTP 500 with an empty body. A normal Linux path works fine.
    • On the latest dev (86ce19d), the same request returns a 404 "Location not found" error instead of a 500.
    • The cause in the desktop app is still on dev: any server at localhost/127.0.0.1 is treated as the app's own local server, so it uses the native Windows folder picker. With a WSL server, that picker returns UNC paths. I haven't checked whether the 404 on dev avoids the fatal error screen.

    The script below reproduces the server-side part. Until this is addressed, @kenden's workaround avoids it: run the server with --hostname 0.0.0.0 and connect to the WSL IP instead of localhost. You then get the in-app Linux folder picker.

    Related: #19473 (same root cause, closed), #33550 and #34255 (closed), and the open PR #53628, which changes the desktop check.

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Server-side half of #52205: a Linux `opencode serve` given the Windows UNC path
    # that the Desktop native folder picker returns for a WSL folder answers HTTP 500.
    # Usage: ./repro.sh                -> uses `opencode` from PATH
    #        OC_DEV=/path/to/repo ./repro.sh -> runs the CLI from a source checkout
    set -u
    PROJ=$(mktemp -d); cd "$PROJ"; git init -q
    PORT=4097; LOG=$(mktemp)
    if [ -n "${OC_DEV:-}" ]; then
      bun --conditions=browser --preload="$OC_DEV/packages/tui/node_modules/@opentui/solid/scripts/preload.js" \
        "$OC_DEV/packages/cli/src/index.ts" serve --hostname 127.0.0.1 --port $PORT >"$LOG" 2>&1 &
    else
      opencode serve --hostname 127.0.0.1 --port $PORT >"$LOG" 2>&1 &
    fi
    SRV=$!
    for i in $(seq 60); do grep -q "server password" "$LOG" && break; sleep 1; done
    PASS=$(sed -n 's/^server password //p' "$LOG")
    for d in "$PROJ" '\\wsl.localhost\UbuntuD\home\tmbv\src\Admin.Net'; do
      echo "== location[directory]=$d"
      curl -s -u "opencode:$PASS" -w '\nHTTP %{http_code}\n' -G \
        --data-urlencode "location[directory]=$d" "http://127.0.0.1:$PORT/api/vcs"
    done
    kill $SRV

    Run it: bash repro.sh

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions