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: crash on startup when running in different containers (or mixed host / container) #56367
Starting with v2 if an opencode instance is being spawned inside a container with shared host network (--network host) while another instance is running outside that container (or if spawned on host while another instance is already running in a container), opencode crashes:
$ opencode
Starting background server...
Error: Server process exited with code 1
Error: 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.
at <anonymous> (/$bunfs/root/chunk-f2pr1npd.js:2:8925) {
[cause]: ServeError:
at P (/$bunfs/root/chunk-wje5hx83.js:52:7706)
at applyHandlers (node:events:64:20)
at emitError (node:events:44:27)
at emitListenErrorNextTick (node:_http_server:134:12)
at processTicksAndRejections (unknown:7:39) {
[cause]: Error: Failed to start server. Is port 49374 in use?
at serve (unknown)
at <anonymous> (node:_http_server:359:39)
at <anonymous> (node:_http_server:332:33)
at <anonymous> (/$bunfs/root/chunk-wje5hx83.js:52:7744)
}
}
at map (unknown:1:11)
at reap (/$bunfs/root/chunk-mtkfx0g6.js:2:1203)
at <anonymous> (/$bunfs/root/chunk-mtkfx0g6.js:3:6711)
at service.ensure (/$bunfs/root/chunk-bsm4erxq.js:3:690)
at service.ensure (definition) (/$bunfs/root/chunk-mtkfx0g6.js:3:5523)
at cli.server-connection.resolve (/$bunfs/root/chunk-ex8cqpvg.js:96:6563)
at cli.server-connection.resolve (definition) (/$bunfs/root/chunk-bsm4erxq.js:2:402)
Plugins
No response
OpenCode version
opencode v2.0.32
Steps to reproduce
spawn opencode v2 on host or inside a docker/podman container with shared network (--network host)
run another opencode instance in another container (or even host, when the other one runs inside a container)
Thanks for the report! I think this is a duplicate of #50672. That issue covers the fixed default service port (49374) colliding across environments that share one loopback, and it names a --network host container as one of the affected cases. Your host and container instances each keep their own service registration, so the second one can't reuse the first one's service and fails to bind the same port.
Possible duplicates and related issues, ordered from most to least likely:
Until it's fixed, you can work around it by giving one environment (for example the container) its own port: opencode service set port <some free port>, then start opencode again.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
We haven't heard back, so I'm closing this as a duplicate of #50672. That issue covers the fixed default service port (49374) colliding between environments that share one loopback, including --network host containers. Please follow #50672 for updates. #52234 is also related.
Until then, you can give one environment its own port with opencode service set port <free port>. If your problem turns out to be different, reply here with the details and we can reopen.
Activity
opencode-agent commentedon Oct 17, 2026
Thanks for the report! I think this is a duplicate of #50672. That issue covers the fixed default service port (
49374) colliding across environments that share one loopback, and it names a--network hostcontainer as one of the affected cases. Your host and container instances each keep their own service registration, so the second one can't reuse the first one's service and fails to bind the same port.Possible duplicates and related issues, ordered from most to least likely:
--network hostcontainer)Until it's fixed, you can work around it by giving one environment (for example the container) its own port:
opencode service set port <some free port>, then start opencode again.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencode-agent commentedon Oct 18, 2026
We haven't heard back, so I'm closing this as a duplicate of #50672. That issue covers the fixed default service port (
49374) colliding between environments that share one loopback, including--network hostcontainers. Please follow #50672 for updates. #52234 is also related.Until then, you can give one environment its own port with
opencode service set port <free port>. If your problem turns out to be different, reply here with the details and we can reopen.