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
attach: @ file mentions use client-local path instead of remote directory #13732
When using opencode attach to connect to a remote OpenCode server, selecting a file via @ mention in the TUI builds a file://... URL using the client machine's process.cwd() (local path), not the remote server's working directory.
This causes the server to resolve the URL on the remote filesystem and try to read a path that only exists on the client (e.g. a macOS path), so the attachment fails / the wrong file is read.
Environment
OpenCode CLI: 1.2.4
Client: macOS
Server: Linux (remote OpenCode server)
Steps to reproduce
Start an OpenCode server on a remote machine (e.g. opencode serve).
On the client machine, run: opencode attach http://<remote-host>:4096 --dir /path/to/project (or attach to a server already running in that project).
In the TUI prompt, type @ and select any file from autocomplete.
Actual
The inserted part uses a file:// URL based on the client's process.cwd() (local path). The server then resolves that URL and tries to read it on the remote filesystem, resulting in file-not-found / incorrect file content.
Expected
@ file mentions during remote attach should resolve against the remote server directory (e.g. the directory returned by path.get() / sync.data.path.directory, or the directory provided via --dir).
Likely cause
packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx currently does:
Use the remote directory from sync (e.g. sync.data.path.directory, sourced from sdk.client.path.get()) as the base directory for pathToFileURL, with a fallback to process.cwd() for local mode.
This issue appears to be related to several existing reports about path resolution when attaching to remote servers. Please check these related issues to see if they address your use case or if there are any workarounds:
Activity
github-actions commentedon Feb 15, 2026
This issue appears to be related to several existing reports about path resolution when attaching to remote servers. Please check these related issues to see if they address your use case or if there are any workarounds:
opencode attach: File path duplicates client's relative directory, causing ENOENT #4967:opencode attachfile path duplicates causing ENOENTattach --dirto connect to a remote serverattach --dirwith remote server is brokenThese issues all involve client-local paths being incorrectly used instead of remote server paths in various attachment scenarios.
OpeOginni commentedon Feb 16, 2026
Yeah Im able to reproduce, and your suggested solution works too.