Desktop on Windows: saved non-ASCII workspace paths break session/model loading #9027

Open
opened 2026-02-16 18:11:26 -05:00 by yindo · 1 comment
Owner

Originally created by @pia on GitHub (Feb 10, 2026).

Originally assigned to: @adamdotdevin on GitHub.

### Summary
On Windows desktop (OpenCode.exe), if the saved workspace/project path contains non-ASCII characters (e.g. Chinese), session/provider loading can fail after upgrade, and the app shows errors like "cannot load sessions" / models not loading.

This looks related to request header construction for x-opencode-directory with non-ASCII paths, but in desktop mode it is also triggered by persisted project state.

Related

Possibly related to #13023 (CLI repro). This issue focuses on desktop persisted state + session/model loading failures.

Environment

  • OpenCode Desktop: 1.1.56
  • OS: Windows 11 (zh-CN locale)
  • Paths involved:
    • C:\学伴助教
    • C:\代码\openclaw\openclaw

Reproduction

  1. Open desktop app and have previously saved projects/workspaces under non-ASCII Windows paths.
  2. Upgrade/use 1.1.56 desktop.
  3. Open app; session list and/or model/provider list may fail to load.

Actual result

Logs repeatedly show:

Header 'x-opencode-directory' has invalid value: 'C:\学伴助教'

(and similarly for C:\代码\openclaw\openclaw).

As a result, desktop UI reports session/model loading failures.

Expected result

  • Non-ASCII project paths should work on Windows.
  • Persisted project entries with Unicode paths should not break session/provider APIs.
  • Desktop should either properly encode header values or avoid using invalid header transport for path values.

Extra observation

Even after fixing config/model settings, desktop can still fail because old paths remain in persisted state:

%APPDATA%\ai.opencode.desktop\opencode.global.dat

If those saved paths are non-ASCII, the app may continue failing on startup requests.

Workaround used

  • Remap to ASCII path alias (e.g. subst Q: C:\学伴助教) and point saved workspace to Q:\.
  • Or manually edit/remove affected saved project entries.

Suggestion

  • Handle Windows Unicode paths safely for any header/path transport.
  • Add migration/sanitization for persisted project list so one bad saved path cannot break session/provider loading.
Originally created by @pia on GitHub (Feb 10, 2026). Originally assigned to: @adamdotdevin on GitHub. ### Summary On Windows desktop (`OpenCode.exe`), if the saved workspace/project path contains non-ASCII characters (e.g. Chinese), session/provider loading can fail after upgrade, and the app shows errors like "cannot load sessions" / models not loading. This looks related to request header construction for `x-opencode-directory` with non-ASCII paths, but in desktop mode it is also triggered by persisted project state. ### Related Possibly related to #13023 (CLI repro). This issue focuses on **desktop persisted state + session/model loading failures**. ### Environment - OpenCode Desktop: `1.1.56` - OS: Windows 11 (zh-CN locale) - Paths involved: - `C:\学伴助教` - `C:\代码\openclaw\openclaw` ### Reproduction 1. Open desktop app and have previously saved projects/workspaces under non-ASCII Windows paths. 2. Upgrade/use `1.1.56` desktop. 3. Open app; session list and/or model/provider list may fail to load. ### Actual result Logs repeatedly show: `Header 'x-opencode-directory' has invalid value: 'C:\学伴助教'` (and similarly for `C:\代码\openclaw\openclaw`). As a result, desktop UI reports session/model loading failures. ### Expected result - Non-ASCII project paths should work on Windows. - Persisted project entries with Unicode paths should not break session/provider APIs. - Desktop should either properly encode header values or avoid using invalid header transport for path values. ### Extra observation Even after fixing config/model settings, desktop can still fail because old paths remain in persisted state: `%APPDATA%\ai.opencode.desktop\opencode.global.dat` If those saved paths are non-ASCII, the app may continue failing on startup requests. ### Workaround used - Remap to ASCII path alias (e.g. `subst Q: C:\学伴助教`) and point saved workspace to `Q:\`. - Or manually edit/remove affected saved project entries. ### Suggestion - Handle Windows Unicode paths safely for any header/path transport. - Add migration/sanitization for persisted project list so one bad saved path cannot break session/provider loading.
yindo added the windowsweb labels 2026-02-16 18:11:26 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 10, 2026):

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

  • #13023: Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header - This appears to be the same issue reported just 2 hours earlier with identical error symptoms.
  • #6610: Header encoding issue with non-ISO-8859-1 characters in Windows
  • #5926: Same error with Chinese characters in path on Windows desktop (oldest report)
  • #6906: Cannot open folders on desktop with Chinese characters in path

These issues share the same root cause: the x-opencode-directory header cannot accept non-ASCII characters on Windows. Consider consolidating these reports.

@github-actions[bot] commented on GitHub (Feb 10, 2026): This issue might be a duplicate of existing issues. Please check: - **#13023**: Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header - This appears to be the same issue reported just 2 hours earlier with identical error symptoms. - **#6610**: Header encoding issue with non-ISO-8859-1 characters in Windows - **#5926**: Same error with Chinese characters in path on Windows desktop (oldest report) - **#6906**: Cannot open folders on desktop with Chinese characters in path These issues share the same root cause: the `x-opencode-directory` header cannot accept non-ASCII characters on Windows. Consider consolidating these reports.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9027