Repository navigation
Description
Description
On a single macOS machine with two login accounts, the second account cannot start OpenCode. The managed background service binds a port that is hardcoded per channel (latest/dev/beta/next → 49374), and ports are machine-wide rather than per-user, so only one login account can run a service at a time.
The second account's client fails and exits immediately:
Managed service port 49374 on 127.0.0.1 is already in use by another process.
Configure another port with `opencode service set port <port>` and start the service again.
A workaround exists (opencode service set port <port>), but the fixed default guarantees the collision. Either derive the port per user or fall back to a free port automatically.
Plugins
None.
OpenCode version
2.0.32 (channel=latest, desktop app). The failing process is the app's managed CLI (.../ai.opencode.desktop/cli/2.0.32-arm64/opencode-cli serve --service). A separate 0.0.0-dev-* build present in the same account was not involved.
Steps to reproduce
- On macOS, log in as user A and start OpenCode so its managed service is listening on
127.0.0.1:49374(lsof -nP -iTCP:49374 -sTCP:LISTENconfirms it). - Leave A running. Log in as user B and start OpenCode.
- B never opens.
~/.local/share/opencode/log/opencode.log(in B's account) repeats:
level=INFO message="cli starting" version=2.0.32 channel=latest local=false args="[\"serve\",\"--service\"]" role=cli
level=ERROR message="cli process failed"
cause="... Managed service port 49374 on 127.0.0.1 is already in use by another process ..."
Expected Behavior
Each login account can run its own OpenCode service — e.g. a per-user default port, or automatic fallback to a free port — instead of a fixed machine-wide 49374.
Actual Behavior
The second account's CLI fails to bind and exits, so the client/app never opens. The only way forward is to manually reassign the port.
Additional Context
- Hardcoded in the 2.0.32 CLI:
if(e==="latest"||e==="dev"||e==="beta"||e==="next") return 49374; if(e==="local") return 49375; - Second account has no
~/.config/opencode/service.jsonand no port setting anywhere, so it necessarily falls back to the default and collides. - Workaround that works: in the second account,
opencode service set port 49375(writes~/.config/opencode/service.json), then start the service.49375is free. - Found after migrating a second account onto the machine; previously the machine had only one OpenCode account, so the collision could not occur. Not a migration/corruption issue.
- Possibly related: PR fix(service): handle unusable managed-service ports on Windows #53355 (
fix(service): handle unusable managed-service ports on Windows).
Operating System
macOS 26.2 (Darwin 25.2.0, arm64 / Apple Silicon)
Terminal
zsh in Terminal.app (also reproduces from the desktop app)
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the detailed report and the workaround. I think this is a duplicate of #50672. That issue covers the same root cause: the managed service's default port (
49374) is fixed for the whole machine, so a second login account can't bind it. Its thread already includes the two-users-on-one-machine case and the sameManaged service port 49374 ... already in useerror. On the currentdevbranch the default is still fixed per channel, with no per-user part and no fallback to a free port.Possible duplicates and closely related issues, ordered from most to least likely:
49374can't be used), but it's triggered by WSL/Hyper-V reserved port rangesUntil it's fixed, your workaround is the way to go: in the second account, run
opencode service set port <free port>and start the service again. A 👍 or a short comment on #50672 noting that this also affects macOS desktop users would help.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
wheelerfam7-commits commentedon Oct 18, 2026
Duplicate of #50672 — confirmed macOS multi-account; added a note there.
opencode-agent commentedon Oct 18, 2026
Thanks for confirming, and for adding the macOS multi-account case to #50672. Further updates will be tracked there. The bot will close this issue as a duplicate as planned. Until it's fixed,
opencode service set port <free port>in the second account is still the workaround.opencode-agent commentedon Oct 19, 2026
Closing this as a duplicate of #50672, which you confirmed, and thanks for adding the macOS multi-account case there. Please follow #50672 for updates on the fixed default port. Until it's fixed, running
opencode service set port <free port>in the second account is the workaround.