anomalyco / anomalyco/opencode

CLI fails with unrecognized flag --port when launched from editor extension

Open
#49,085 0 comments 2 reactions 1 assignee View on GitHub

@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
  1. Run opencode --port 40879
  2. Observe Unrecognized flag: --port in command opencode
  3. Symlink opencode2 shim into ~/.local/bin/opencode2 and run opencode2
  4. Observe cannot execute: No such file or directory
OpenCode version

v2.0.3

Operating System

macOS / Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.