opencode在带有中文路径的文件下无法打开 #9032

Open
opened 2026-02-16 18:11:27 -05:00 by yindo · 5 comments
Owner

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

Originally assigned to: @rekram1-node on GitHub.

Description

opencode自动更新后,在windows 11系统里,在带有中文路径的文件夹下,运行打开opencode会报错:
{
"name": "UnknownError",
"data": {
"message": "TypeError: Header 'x-opencode-directory' has invalid value: 'D:\项目\AI\template\xxx'\n at set (unknown)\n at mergeHeaders (../sdk/js/src/gen/client/utils.gen.ts:184:23)\n at mergeConfigs (../sdk/js/src/gen/client/utils.gen.ts:161:20)\n at createClient (../sdk/js/src/gen/client/client.gen.ts:21:17)\n at createOpencodeClient (../sdk/js/src/client.ts:28:18)\n at (src/plugin/index.ts:25:20)\n at (src/project/state.ts:22:21)\n at init2 (src/plugin/index.ts:123:25)\n at InstanceBootstrap (src/project/bootstrap.ts:19:16)\n at (src/project/instance.ts:34:23)\n at async provide (src/project/instance.ts:40:23)"
}
}

Plugins

No response

OpenCode version

1.1.56

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @changzhengithub on GitHub (Feb 10, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description opencode自动更新后,在windows 11系统里,在带有中文路径的文件夹下,运行打开opencode会报错: { "name": "UnknownError", "data": { "message": "TypeError: Header 'x-opencode-directory' has invalid value: 'D:\\项目\\AI\\template\\xxx'\n at set (unknown)\n at mergeHeaders (../sdk/js/src/gen/client/utils.gen.ts:184:23)\n at mergeConfigs (../sdk/js/src/gen/client/utils.gen.ts:161:20)\n at createClient (../sdk/js/src/gen/client/client.gen.ts:21:17)\n at createOpencodeClient (../sdk/js/src/client.ts:28:18)\n at <anonymous> (src/plugin/index.ts:25:20)\n at <anonymous> (src/project/state.ts:22:21)\n at init2 (src/plugin/index.ts:123:25)\n at InstanceBootstrap (src/project/bootstrap.ts:19:16)\n at <anonymous> (src/project/instance.ts:34:23)\n at async provide (src/project/instance.ts:40:23)" } } ### Plugins _No response_ ### OpenCode version 1.1.56 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the windowsbug labels 2026-02-16 18:11:27 -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
  • #13061: Chinese/Unicode path broken since v1.1.54 - 'Failed to reload [object Object]' / 'List files failed'
  • #13060: Desktop on Windows: saved non-ASCII workspace paths break session/model loading
  • #6610: Failed to execute 'set' on 'Headers': String contains non ISO-8859-1 code point
  • #5926: Windows version of the .exe terminal will report an error when opening a project folder with Chinese characters

Consider consolidating with #13023, which appears to be nearly identical and was created on the same day.

@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 - #13061: Chinese/Unicode path broken since v1.1.54 - 'Failed to reload [object Object]' / 'List files failed' - #13060: Desktop on Windows: saved non-ASCII workspace paths break session/model loading - #6610: Failed to execute 'set' on 'Headers': String contains non ISO-8859-1 code point - #5926: Windows version of the .exe terminal will report an error when opening a project folder with Chinese characters Consider consolidating with #13023, which appears to be nearly identical and was created on the same day.
Author
Owner

@YooPh commented on GitHub (Feb 10, 2026):

I also encountered the same problem

@YooPh commented on GitHub (Feb 10, 2026): I also encountered the same problem
Author
Owner

@changzhengithub commented on GitHub (Feb 10, 2026):

I hope to solve this problem.

@changzhengithub commented on GitHub (Feb 10, 2026): I hope to solve this problem.
Author
Owner

@pythonmumude commented on GitHub (Feb 10, 2026):

mac中文路径 也打不开。

@pythonmumude commented on GitHub (Feb 10, 2026): mac中文路径 也打不开。
Author
Owner

@mml1988 commented on GitHub (Feb 11, 2026):

When is it expected to be resolved?

@mml1988 commented on GitHub (Feb 11, 2026): When is it expected to be resolved?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9032