anomalyco / anomalyco/opencode
CLI fails with unrecognized flag --port when launched from editor extension
Open
@neriousy is already working on this.
Since Sep 15, 2026.
2.0
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When launching OpenCode from editor extensions (such as sdks/vscode/src/extension.ts which invokes opencode --port <port>), the CLI exits with:
ERROR
Unrecognized flag: --port in command opencode
Additionally, the legacy shims in install and packages/cli/script/publish-aur.ts use exec "$(dirname "$0")/opencode" "$@". When the shim is invoked through a symlink (e.g. from ~/.local/bin or /usr/local/bin), $(dirname "$0") points to the directory containing the symlink rather than the installed binary, resulting in:
exec: .../opencode: cannot execute: No such file or directory
Steps to reproduce
- Run
opencode --port 40879 - Observe
Unrecognized flag: --port in command opencode - Symlink
opencode2shim into~/.local/bin/opencode2and runopencode2 - Observe
cannot execute: No such file or directory
OpenCode version
v2.0.3
Operating System
macOS / Linux
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.