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
CLI fails with unrecognized flag --port when launched from editor extension #49085
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 opencode2 shim into ~/.local/bin/opencode2 and run opencode2
Observe cannot execute: No such file or directory
OpenCode version
v2.0.3
Operating System
macOS / Linux
Reacted by paulhodson, dE fENDER, Benjamin Robinet, Marcus1Pierce, Steven, Matt Goldman, Przemek, qiushifelix, Adnan Muradbegović, OldStarchy and 15 more
Fixed in the VS Code extension v1.0.0, now on the Marketplace and Open VSX. It launches opencode without --port, so it works with the V2 CLI. Update the extension to get it.
Thanks for the report! I think the --port part is a duplicate of #49992, which your own PR #49084 already fixed: the VS Code extension now launches plain opencode without --port. Please update to the latest v2 release (v2.1.0 or later) and the extension should start normally.
Possible duplicates and related issues, ordered by likelihood:
On the opencode2 shim: the install script puts it in the same folder as the opencode binary, and it works when run from there. It only fails if you symlink it into a different folder. (packages/cli/script/publish-aur.ts has also been removed since v2.0.3.) If the shim also fails with the standard install, please say so here with the steps.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Closing this as a duplicate of #49992, since there's been no reply in the day since the duplicate notice. The --port error from the VS Code extension was fixed by #49084, which launches plain opencode, so updating to v2.1.0 or later should fix it. If you still see the error after updating, or the opencode2 shim fails with the standard install (not symlinked elsewhere), please comment here with the steps and we can reopen.
Activity
nestorFigliuolo commentedon Oct 7, 2026
Any update on this isseu?
Omar-Elmassry commentedon Oct 9, 2026
facing the same issue
xxl4tomxu98 commentedon Oct 12, 2026
@nestorFigliuolo @uyencss @palmamartin @neriousy @Omar-Elmassry May I ask if this issue had been resolved? I am waiting for the resolution!!
rekram1-node commentedon Oct 14, 2026
Fixed in the VS Code extension v1.0.0, now on the Marketplace and Open VSX. It launches opencode without --port, so it works with the V2 CLI. Update the extension to get it.
docs+config: connect OpenCode to notes-server (verified live)
opencodejr commentedon Oct 28, 2026
Thanks for the report! I think the
--portpart is a duplicate of #49992, which your own PR #49084 already fixed: the VS Code extension now launches plainopencodewithout--port. Please update to the latest v2 release (v2.1.0 or later) and the extension should start normally.Possible duplicates and related issues, ordered by likelihood:
--port; closed by fix(vscode): launch the V2 CLI without --port #49084On the
opencode2shim: the install script puts it in the same folder as theopencodebinary, and it works when run from there. It only fails if you symlink it into a different folder. (packages/cli/script/publish-aur.tshas also been removed since v2.0.3.) If the shim also fails with the standard install, please say so here with the steps.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencodejr commentedon Oct 29, 2026
Closing this as a duplicate of #49992, since there's been no reply in the day since the duplicate notice. The
--porterror from the VS Code extension was fixed by #49084, which launches plainopencode, so updating to v2.1.0 or later should fix it. If you still see the error after updating, or theopencode2shim fails with the standard install (not symlinked elsewhere), please comment here with the steps and we can reopen.