Skip to content

Desktop sends Windows-native paths to WSL server after directory rename, breaking session list with "Path is not absolute" error #33550

Description

@WhiteGiverMa

Description

When using OpenCode Desktop (Windows) connected to an opencode serve instance running inside WSL2, renaming a project directory causes Desktop to send Windows-native paths (e.g. G:/dev/dreamer-heroines) to the WSL server, which expects Linux-native paths (e.g. /mnt/g/dev/dreamer-heroines). This results in Path is not absolute errors and Unexpected server error in the UI.

This is a variant of #30895, triggered specifically by the directory rename scenario where the Windows-side DB retains the renamed Windows path but no path translation occurs when communicating with the WSL server.

Environment

Component Version / Detail
Desktop OpenCode Desktop (Electron), Windows 11
WSL server opencode serve v1.17.9, WSL2 Ubuntu 24.04
Kernel 6.6.87.2-microsoft-standard-WSL2
Connection Desktop → http://localhost:4096 (WSL2 port-forwarded)
Project G:\dev\dreamer-heroines (Windows) / /mnt/g/dev/dreamer-heroines (WSL)

Root cause

Desktop reads the Windows-native path G:/dev/dreamer-heroines from its local SQLite DB and sends it without translation to the WSL server via the session list API:

GET /session?directory=G:/dev/dreamer-heroines

On the WSL (Linux) side, path.resolve("G:/dev/dreamer-heroines") treats the Windows path as relative, prepending the server's CWD:
/home/{user}/G:/dev/dreamer-heroines → path doesn't exist → HTTP 500

This is the same path translation bug as #30895, but the rename scenario adds complexity:

  • Both databases (Windows-side and WSL-side) are independently correct for their platform
  • The bug only manifests in the cross-server API communication layer
  • Changing Windows-side DB paths to /mnt/g/ format fixes the WSL interaction but breaks Desktop's native file operations

Expected behavior

When Desktop communicates with a remote/WSL server, it should translate Windows-native paths (G:/dev/...) to the server's native format (/mnt/g/dev/...) before sending API requests.

Actual behavior

Desktop sends Windows-native paths directly to the WSL server, causing Path is not absolute errors and breaking the session list and file picker.

Workaround

Delete the project record from the Windows-side DB so Desktop re-discovers it:

DELETE FROM session WHERE project_id = '<project_hash>';
DELETE FROM project_directory WHERE project_id = '<project_hash>';
DELETE FROM project WHERE id = '<project_hash>';

Then clear Electron cache and restart Desktop. The project will need to be re-added manually.

Related issues

Plugins

Oh My OpenAgent (the bug is a original behavior.)

OpenCode version

1.17.9

Steps to reproduce

  1. In WSL2, start the server:

    cd /mnt/g/dev/dreamer-heroines
    opencode serve --hostname 0.0.0.0 --port 4096
  2. On Windows, rename the project folder from DreamerHeroines to dreamer-heroines (case change).

  3. Open OpenCode Desktop and connect to http://localhost:4096.

  4. Open the project G:\dev\dreamer-heroines from the project list.

  5. Observe the sidebar error:

    Unexpected server error. Check server logs for details.
    
  6. Check WSL server logs (journalctl):

    ERROR: Path is not absolute: G:/dev/dreamer-heroines
      at U0 (chunk-arezpm57.js:59:16502)
      at buildQueryFromSourceParams (chunk-arezpm57.js:2:5450)
      at Session.list (chunk-e6zcxa2p.js:3:8541)
    
  7. Also observe file picker corruption:

    ERROR: Failed to init file picker: Invalid path /home/{user}/G:/dev/dreamer-heroines
    

Screenshot and/or share link

No response

Operating System

Windows 11 & WSL2 Ubuntu 24.04

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions