Description
🐞 Description
Any file stored inside a directory whose name contains a space—for example
Research Journals/2025-07-08.md
—cannot be accessed or updated through OpenCode.
Whether the file is referenced in a patch header or via an @
mention in chat, the request fails with:
400 Bad Request
{
"name": "UnknownError",
"data": {
"message": "Error: ENOENT: no such file or directory, open '/Users/.../Research%20Journals/2025-07-08.md'"
}
}
The %20
shows that the path is still URL-encoded when it reaches the filesystem, so Node throws ENOENT
.
🔬 Steps to reproduce
-
Create a file at
~/Documents/Notes/Research Journals/test.md
. -
In OpenCode chat, type something like
Could you update @Research Journals/test.md?
or send a patch that begins with
*** Update File: Research%20Journals/test.md
-
The server responds with 400 and logs the
ENOENT
error above.
✅ Expected behaviour
Requests that target paths with spaces succeed; the path shown in logs is the decoded version (Research Journals/test.md
).
❌ Actual behaviour
The path remains percent-encoded (Research%20Journals/test.md
) all the way to fs.open()
, resulting in ENOENT
.
🌎 Environment
Component | Version |
---|---|
OpenCode | main @ f84c8fe (2025-07-09) |
Runtime | Bun 1.1.4 / Node 20.15.0 |
OS | macOS 14.5 (APFS) |
📝 Notes
-
Happens with both PATCH requests and simple
@file
references in chat. -
Moving the note to a directory without spaces (or symlinking) avoids the error, but that’s only a temporary workaround.