GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header · Issue #13023 · anomalyco/opencode

Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header #13023

New issue
Copy link
New issue
Copy link
Closed
#13131
Closed
Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header#13023
#13131
Copy link
Assignees
rekram1-node
Labels
windows

Description

@baodexiang
baodexiang
opened on Feb 10, 2026
Issue body actions

Environment: opencode 1.1.55 on Windows (PowerShell), locale zh-CN, working directory C:\Users\baode\OneDrive\桌面. Repro steps: (1) cd C:\Users\baode\OneDrive\桌面 (2) run opencode. Actual result: startup fails with TypeError: Header 'x-opencode-directory' has invalid value containing Chinese path characters. Expected result: opencode should start normally in Unicode/non-ASCII paths. Workaround: running from ASCII-only path works (for example C:\work\test).

Reacted by KangWang42

Activity

  1. baodexiang commented on Feb 10, 2026

    @baodexiang
    baodexiang
    on Feb 10, 2026
    Author
    More actions

    Additional details from reproduction (PowerShell in Chinese path):\n\n\n\nASCII path workaround still works.

  2. github-actions
    assigned
    rekram1-node
    on Feb 10, 2026
  3. github-actions
    added
    windows
    on Feb 10, 2026
  4. baodexiang commented on Feb 10, 2026

    @baodexiang
    baodexiang
    on Feb 10, 2026
    Author
    More actions

    Corrected stack trace from reproduction:

    UnknownError
    TypeError: Header x-opencode-directory has invalid value: C:\Users�aode\OneDrive\桌面
    at set (unknown)
    at mergeHeaders (../sdk/js/src/gen/client/utils.gen.ts:184:23)
    at mergeConfigs (../sdk/js/src/gen/client/utils.gen.ts:161:20)
    at createClient (../sdk/js/src/gen/client/client.gen.ts:21:17)
    at createOpencodeClient (../sdk/js/src/client.ts:28:18)
    at (src/plugin/index.ts:25:20)
    at (src/project/state.ts:22:21)
    at init2 (src/plugin/index.ts:123:25)
    at InstanceBootstrap (src/project/bootstrap.ts:19:16)
    at (src/project/instance.ts:34:23)
    at async provide (src/project/instance.ts:40:23)

    ASCII path workaround still works.

  5. github-actions commented on Feb 10, 2026

    @github-actions
    github-actionsBot
    on Feb 10, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • bug: cant open folders on desktop w/ chinese characters in path #6906: bug: cant open folders on desktop w/ chinese characters in path (v1.1.1)
    • Windows version of the .exe terminal will report an error when opening a project folder with Chinese characters. #5926: Windows version of the .exe terminal will report an error when opening a project folder with Chinese characters (v1.0.185)
    • Undo/revert fails for files with non-ASCII filenames on Windows #10210: Undo/revert fails for files with non-ASCII filenames on Windows (v1.1.34)

    All three issues involve non-ASCII character handling on Windows. This issue specifically mentions the x-opencode-directory header, which provides additional specificity about the root cause. You may want to consolidate these issues or check if one of the existing issues has already been fixed or is being actively worked on.

  6. baodexiang commented on Feb 10, 2026

    @baodexiang
    baodexiang
    on Feb 10, 2026
    Author
    More actions

    Path value correction (literal): 'C:\Users\baode\OneDrive\桌面'

  7. KolbyML commented on Feb 11, 2026

    @KolbyML
    KolbyML
    on Feb 11, 2026
    More actions

    I get this bug too, but in linux with japanese text

  8. canyue7897 commented on Feb 11, 2026

    @canyue7897
    canyue7897
    on Feb 11, 2026
    More actions

    同样问题,gemini cli已经修复:
    gemini cli给出的意见:
    结论完全反转:这不是你的路径问题,是 OpenCode 1.1.55 的回归 Bug
    铁证
    我刚才用你机器上保留的旧版本 1.1.53 在 完全相同的中文路径 下启动:
    "C:\Scoop\apps\opencode\1.1.53\opencode.exe"

    工作目录: D:\python\控制

    结果:完美启动,TUI 正常渲染,状态栏正确显示 D:\python\控制:win7-legacy,MCP 服务连接正常。
    时间线还原

    时间 事件 中文路径支持
    之前 OpenCode 1.1.53 ✅ 正常工作
    2026-02-11 05:41 scoop 自动更新到 1.1.55 ❌ 崩溃
    今早 你发现启动失败 —
    根因:OpenCode 1.1.55 的 SDK 客户端代码(sdk/js/src/gen/client/utils.gen.ts)中 mergeHeaders 函数新增或修改了 HTTP Header 值的校验逻辑,对 x-opencode-directory 这个 Header 启用了严格的 ASCII-only 校验,导致包含中文的路径被拒绝。这是 1.1.55 引入的回归 Bug,不是你的项目问题。

    立即修复:回滚到 1.1.53
    scoop reset [email protected]
    这会将 current 符号链接重新指向 1.1.53 目录,零数据丢失、零配置变更。
    如果你想锁定版本防止再次被自动更新覆盖:
    scoop hold opencode
    之后手动升级时用 scoop unhold opencode && scoop update opencode。
    gemini cli解决方法:
    修复完成。以下是完整状态总结:

    修复摘要
    根因
    OpenCode 1.1.55 的 v1 SDK 客户端(sdk/js/src/client.ts)在设置 x-opencode-directory HTTP Header 时未对非 ASCII 字符编码,而 1.1.55 内嵌的 Bun 运行时对 Header 值启用了严格的 ASCII-only 校验,导致中文路径崩溃。
    补丁内容
    在二进制中定位并修补了两处 v1 客户端代码(config5 @ 0x7317C8C,config4 @ 0x8459C03),将:
    "x-opencode-directory": config5.directory
    替换为:
    "x-opencode-directory": encodeURIComponent(config5.directory)
    等长替换(134 字节 → 134 字节),零偏移量变动。
    文件状态

    文件 说明
    opencode.exe 当前被进程锁定(未修改)
    opencode.exe.bak 原始备份
    opencode_patched.exe 已修补的版本
    apply_patch.cmd 替换脚本
    下一步
    1. 关闭当前 OpenCode(Ctrl+C 或退出 TUI)
    2. 运行替换脚本:
      C:\Scoop\apps\opencode\1.1.55\apply_patch.cmd
      3. 在中文路径下重新启动 OpenCode 验证修复
      ⚠ 已知局限
    3. 数字签名失效:补丁后 SmartScreen 可能报"未知发布者"——预期行为,不影响功能
    4. 版本锁定:补丁仅适用于 1.1.55,升级后需重新评估。建议 scoop hold opencode 防止自动更新覆盖
      执行指令
    5. 关闭当前 OpenCode(Ctrl+C)
    6. 运行: C:\Scoop\apps\opencode\1.1.55\apply_patch.cmd
    7. 在 D:\python\gemini控制 下启动 OpenCode 验证
    8. 可选: scoop hold opencode(锁定版本)
  9. canyue7897 commented on Feb 11, 2026

    @canyue7897
    canyue7897
    on Feb 11, 2026
    More actions

    经gemini cli修复已经正常
    希望官人尽快修复
    不然下次更新又要重新修复

  10. passwa11 commented on Feb 11, 2026

    @passwa11
    passwa11
    on Feb 11, 2026
    More actions

    I also encountered the same problem in zh-Hant

  11. echoVic
    added a commit that references this issue on Feb 11, 2026

    fix: encode non-ASCII directory path in v1 SDK client header

    This issue will close once commit f328ed4 is merged into the 'dev' branch.
    f328ed4
  12. mml1988 commented on Feb 11, 2026

    @mml1988
    mml1988
    on Feb 11, 2026
    More actions

    When is it expected to be resolved?

  13. adamdotdevin
    closed this as completedin #13131on Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.