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
[v2 Windows] opencode2 hangs at "Starting background server..." after reinstall #41746
This issue might be a duplicate of existing issues. Please check:
opencode2 became stuck starting its managed background server #41696: Similar symptom — opencode2 hangs at "Starting background server..." / stuck starting its managed background server (different root cause suspected: port conflict vs. Windows reinstall, but the failure mode is the same)
If your issue is distinct from #41696, feel free to add that context to help maintainers differentiate them.
Ran into this on Windows. In my case the timeout was caused by a port collision with Windows dynamic port reservations. On Windows, especially with Hyper-V, WSL2 or Docker installed it likes to reserve large blocks of ports.
The CLI hung and eventually threw:
Error: Timed out waiting for the background service to start
Checking ~/.local/share/opencode/log/opencode.log showed the actual error:
Managed service port 49374 on 127.0.0.1 is already in use by another process.
Running netsh interface ipv4 show excludedportrange protocol=tcp confirmed that Hyper-V/WSL had reserved ports
49336 to 49435, preventing the background service from binding to 49374.
Setting an unreserved port resolved it: powershell opencode service set port 40900 opencode service start
Two improvements would probably help here:
Surface stderr from the background service in the CLI rather than silently waiting for the timeout.
Retry with an alternate port (or request port 0 and persist what the OS assigns) when hitting EADDRINUSE / WSAEACCES.
I had the same issue on WSL after upgrading from v1 to v2 via opencode upgrade --major, even after fully uninstalling and reinstalling via NPM
In the end, I fully (re)uninstalled and installed via curl -fsSL https://opencode.ai/v2/install | bash — and it worked.
Seems like the upgrade and NPM or PNPM installations aren't v2-ready yet.
Thanks for the report, and sorry for the slow reply. 0.0.0-next-17155 is an old pre-release build, and the background service startup on Windows has changed a lot since then. In the comments here, the hang was traced to Windows (Hyper-V / WSL2 / Docker) reserving a range of ports that includes the old default service port 49374. Since v2.2.0, the Windows default port is 28894, outside those ranges, and startup errors are shown instead of a silent hang.
Could you try the latest v2 release and let us know if it still happens? If it does, please share:
The output of opencode --version.
Any error printed after Starting background server....
The latest entries of %USERPROFILE%\.local\share\opencode\log\opencode.log from that launch. Please remove API keys and other sensitive data first.
The output of netsh interface ipv4 show excludedportrange protocol=tcp.
If you're stuck on an older version, opencode service set port <port> with a free port below 49152, then opencode service start, has worked around this for others.
You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.
Related issues, ordered by likelihood that they're the same problem:
Thanks for following up!
I have upgraded to the latest version and can confirm that the issue is
resolved—the background server now starts up properly and
everything is working smoothly.
Thank you for the fix! You can go ahead and close this issue.
2026年10月29日(木) 6:31 opencodejr[bot] ***@***.***>:
We haven't heard back, so I'm closing this for now. The hang at Starting background server... on 0.0.0-next-17155 was most likely Windows reserving a port range that includes the old default service port 49374. Since v2.2.0, the Windows default port is 28894, outside those ranges, and startup errors are shown instead of a silent hang.
If it still happens on the latest v2 release, please comment here with the output of opencode --version, any error printed after Starting background server..., and the latest entries from %USERPROFILE%\.local\share\opencode\log\opencode.log (with sensitive data removed). We'll reopen it. In the meantime, opencode service set port <port> with a free port below 49152, followed by opencode service start, works around it. #52234 tracks the same port problem.
Activity
github-actions commentedon Aug 11, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from #41696, feel free to add that context to help maintainers differentiate them.
opencode-agent commentedon Aug 11, 2026
Thanks for the report. Could you reproduce this once more and share the relevant log output?
On Windows, the installed-build log is at:
Please redact API keys, authorization headers, prompts, file contents, and any other sensitive data before sharing it.
Double77x commentedon Sep 7, 2026
Ran into this on Windows. In my case the timeout was caused by a port collision with Windows dynamic port reservations. On Windows, especially with Hyper-V, WSL2 or Docker installed it likes to reserve large blocks of ports.
The CLI hung and eventually threw:
Checking
~/.local/share/opencode/log/opencode.logshowed the actual error:Running
netsh interface ipv4 show excludedportrange protocol=tcpconfirmed that Hyper-V/WSL had reserved ports49336 to 49435, preventing the background service from binding to 49374.
Setting an unreserved port resolved it:
powershell opencode service set port 40900 opencode service startTwo improvements would probably help here:
fix(cli): resolve background service port collision on Windows
humb1t commentedon Sep 16, 2026
I get same issue on linux machine today
laundry-96 commentedon Oct 7, 2026
I'm getting the same issue. I have multiple users on my server, so the port can be blocked by other people
luzdealba commentedon Oct 12, 2026
I had the same issue on WSL after upgrading from v1 to v2 via
opencode upgrade --major, even after fully uninstalling and reinstalling via NPMIn the end, I fully (re)uninstalled and installed via
curl -fsSL https://opencode.ai/v2/install | bash— and it worked.Seems like the upgrade and NPM or PNPM installations aren't v2-ready yet.
opencodejr commentedon Oct 28, 2026
Thanks for the report, and sorry for the slow reply.
0.0.0-next-17155is an old pre-release build, and the background service startup on Windows has changed a lot since then. In the comments here, the hang was traced to Windows (Hyper-V / WSL2 / Docker) reserving a range of ports that includes the old default service port49374. Since v2.2.0, the Windows default port is28894, outside those ranges, and startup errors are shown instead of a silent hang.Could you try the latest v2 release and let us know if it still happens? If it does, please share:
opencode --version.Starting background server....%USERPROFILE%\.local\share\opencode\log\opencode.logfrom that launch. Please remove API keys and other sensitive data first.netsh interface ipv4 show excludedportrange protocol=tcp.If you're stuck on an older version,
opencode service set port <port>with a free port below 49152, thenopencode service start, has worked around this for others.You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.
Related issues, ordered by likelihood that they're the same problem:
opencode2stuck starting its background serverantigravity-unleashed commentedon Oct 28, 2026
opencodejr commentedon Oct 31, 2026
We haven't heard back, so I'm closing this for now. The hang at
Starting background server...on0.0.0-next-17155was most likely Windows reserving a port range that includes the old default service port49374. Since v2.2.0, the Windows default port is28894, outside those ranges, and startup errors are shown instead of a silent hang.If it still happens on the latest v2 release, please comment here with the output of
opencode --version, any error printed afterStarting background server..., and the latest entries from%USERPROFILE%\.local\share\opencode\log\opencode.log(with sensitive data removed). We'll reopen it. In the meantime,opencode service set port <port>with a free port below 49152, followed byopencode service start, works around it. #52234 tracks the same port problem.