You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: opencode fails in non-ASCII (Chinese) directory with invalid x-opencode-directory header #13023
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).
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)
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.
Activity
baodexiang commentedon Feb 10, 2026
Additional details from reproduction (PowerShell in Chinese path):\n\n\n\nASCII path workaround still works.
baodexiang commentedon Feb 10, 2026
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.
github-actions commentedon Feb 10, 2026
This issue might be a duplicate of existing issues. Please check:
All three issues involve non-ASCII character handling on Windows. This issue specifically mentions the
x-opencode-directoryheader, 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.baodexiang commentedon Feb 10, 2026
Path value correction (literal): 'C:\Users\baode\OneDrive\桌面'
KolbyML commentedon Feb 11, 2026
I get this bug too, but in linux with japanese text
canyue7897 commentedon Feb 11, 2026
同样问题,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 服务连接正常。
时间线还原
立即修复:回滚到 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 字节),零偏移量变动。
文件状态
C:\Scoop\apps\opencode\1.1.55\apply_patch.cmd
3. 在中文路径下重新启动 OpenCode 验证修复
⚠ 已知局限
执行指令
canyue7897 commentedon Feb 11, 2026
经gemini cli修复已经正常
希望官人尽快修复
不然下次更新又要重新修复
passwa11 commentedon Feb 11, 2026
I also encountered the same problem in zh-Hant
fix: encode non-ASCII directory path in v1 SDK client header
mml1988 commentedon Feb 11, 2026
When is it expected to be resolved?