anomalyco / anomalyco/opencode
Directory path truncated on nested instance creation with Korean folder names (ENOENT FileSystem.realPath)
@Hona is already working on this.
Since Aug 21, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
opencode version: 1.18.18
Platform: Windows 11
What happened
Opening a project whose path contains Korean (multi-byte) characters occasionally causes a second, malformed internal instance to be created with a leading path segment silently dropped, which then fails with an ENOENT error when opencode tries to resolve the environment/system prompt for a chat request.
Log excerpt (directory names transliterated below since GitHub may mangle raw Korean in code blocks, but the real log had actual Korean characters):
timestamp=... message="creating instance" directory="D:\ai-project-root\job-search-ai\ai-job-search"
timestamp=... message="creating instance" directory="D:\job-search-ai\ai-job-search"
...
timestamp=... level=ERROR message=failed ref=err_471ab360 error="PlatformError: NotFound: FileSystem.realPath (D:\job-search-ai\ai-job-search) (cause: Error: ENOENT: no such file or directory, lstat 'D:\job-search-ai')"
The real, correct path is D:\ai-project-root\job-search-ai\ai-job-search (exists on disk and is a valid git repo). A second internal "creating instance" call is made moments later with the leading ai-project-root\ segment missing, producing a path that does not exist, and the subsequent FileSystem.realPath lookup on that bad path throws ENOENT, surfacing as a generic "server error" to the user in the TUI.
Steps to reproduce
- Create/open a project under a path containing multi-byte (Korean) directory names, several levels deep (e.g.
D:\<korean-name>\<korean-name>\project). - Launch opencode's interactive TUI in that directory and send a chat message.
- Intermittently (not on every launch) the request fails with a server-side error; the log shows a truncated-path ENOENT as above.
Note: Running opencode run "..." directly via the CLI in the exact same directory did NOT reproduce the issue -- it only showed up in the interactive TUI, and closing/reopening the TUI window made it go away, suggesting some cached/derived path is computed once (incorrectly, dropping a leading segment) during that TUI session and then reused for subsequent instance creation.
Expected: The directory path should be preserved exactly through all internal instance-creation calls regardless of non-ASCII characters in the path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.