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
After updated to 2.0.30, it failed to launch when I run opencode in powershell. The output is below
Starting background server...
Error: Server process exited with code 1
Error: Managed service port 45280 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> (B:/~BUN/root/chunk-cpy1dpqz.js:2:8961) {
[cause]: ServeError:
at G (B:/~BUN/root/chunk-sc9rkx6z.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 45280 in use?
at serve (unknown)
at <anonymous> (node:_http_server:359:39)
at <anonymous> (node:_http_server:332:33)
at <anonymous> (B:/~BUN/root/chunk-sc9rkx6z.js:52:7744)
}
}
at map (unknown:1:11)
at reap (B:/~BUN/root/chunk-w65nqadd.js:2:1203)
at <anonymous> (B:/~BUN/root/chunk-w65nqadd.js:3:6711)
at service.ensure (B:/~BUN/root/chunk-ysxwc36y.js:3:690)
at service.ensure (definition) (B:/~BUN/root/chunk-w65nqadd.js:3:5523)
at cli.server-connection.resolve (B:/~BUN/root/chunk-mfv1h06t.js:96:6568)
at cli.server-connection.resolve (definition) (B:/~BUN/root/chunk-ysxwc36y.js:2:402)
And problem isn't fixed after I run opencode service set port xxx.
Thanks for the report! 2.0.30 moved the default Windows service port (to 45278) to avoid ports that Windows reserves. Your error mentions 45280, which isn't a default, so I'd like to understand what's holding the port. Could you share:
Which port(s) you set with opencode service set port .... Is 45280 one of them? And what error do you get when you run opencode after setting a different port? Does it still mention 45280?
If netstat shows a PID, please also share tasklist /FI "PID eq <pid>".
The lines from around the failed start in %USERPROFILE%\.local\share\opencode\log\opencode.log, especially any ERROR lines. Please remove anything private first.
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.
These existing issues may be related, ordered by likelihood. Please check whether one of them already covers your problem:
Thanks for the report! 2.0.30 moved the default Windows service port (to 45278) to avoid ports that Windows reserves. Your error mentions 45280, which isn't a default, so I'd like to understand what's holding the port. Could you share:
Which port(s) you set with opencode service set port .... Is 45280 one of them? And what error do you get when you run opencode after setting a different port? Does it still mention 45280?
The output of opencode service get.
Using the port from the error, the output of:
netstat -ano | findstr 45280
netsh interface ipv4 show excludedportrange protocol=tcp
If netstat shows a PID, please also share tasklist /FI "PID eq <pid>".
The lines from around the failed start in %USERPROFILE%\.local\share\opencode\log\opencode.log, especially any ERROR lines. Please remove anything private first.
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.
These existing issues may be related, ordered by likelihood. Please check whether one of them already covers your problem:
Thanks, that's very helpful. The log gives a clear picture:
After the upgrade, every launch starts two background service processes about 5 seconds apart. Both fail to bind for the full 15 s retry window, first on 45278 and later on 45280 after your service set port. Neither ever starts listening, so this isn't two of our own processes fighting over the port.
Neither port is in your excluded port ranges, so it isn't the Windows reserved-range problem either.
Your old 2.0.29 service was still running right after the npm upgrade, but it used port 49374, so it shouldn't block 45278 or 45280.
So Windows reports the port as in use (EADDRINUSE), and we can't yet see what's holding it. Could you try a few things:
Run these and paste the output (empty output is useful too):
netstat -ano | findstr ":45278 :45280"
If a PID shows up, please also run tasklist /FI "PID eq <pid>".
Go back to the port that worked on 2.0.29 and see if opencode starts:
opencode service set port 49374
opencode
If that also fails, please try a port outside Windows' dynamic range, e.g. opencode service set port 8080, and tell us which ports work and which fail.
If netstat shows nothing on those ports: do you use a firewall, antivirus or VPN tool that could block local listening sockets?
In the meantime, opencode --standalone should let you work: it runs a private server instead of the shared background service. To go back to the default port later, run opencode service unset port.
Thanks, that's very helpful. The log gives a clear picture:
After the upgrade, every launch starts two background service processes about 5 seconds apart. Both fail to bind for the full 15 s retry window, first on 45278 and later on 45280 after your service set port. Neither ever starts listening, so this isn't two of our own processes fighting over the port.
Neither port is in your excluded port ranges, so it isn't the Windows reserved-range problem either.
Your old 2.0.29 service was still running right after the npm upgrade, but it used port 49374, so it shouldn't block 45278 or 45280.
So Windows reports the port as in use (EADDRINUSE), and we can't yet see what's holding it. Could you try a few things:
Run these and paste the output (empty output is useful too):
netstat -ano | findstr ":45278 :45280"
If a PID shows up, please also run tasklist /FI "PID eq <pid>".
Go back to the port that worked on 2.0.29 and see if opencode starts:
opencode service set port 49374
opencode
If that also fails, please try a port outside Windows' dynamic range, e.g. opencode service set port 8080, and tell us which ports work and which fail.
If netstat shows nothing on those ports: do you use a firewall, antivirus or VPN tool that could block local listening sockets?
In the meantime, opencode --standalone should let you work: it runs a private server instead of the shared background service. To go back to the default port later, run opencode service unset port.
Thanks for running all those checks. Your results narrow it down well. On your machine Windows refuses ports 45278 (the new 2.0.30 default) and 45280 as "in use", even though nothing is listening on them and neither is in an excluded port range. The old port 49374 works. The current dev branch (00e7472) still uses 45278 by default on Windows, so a newer build would most likely behave the same for you.
This only happens on Windows, and I can only test on Linux here, so I couldn't reproduce it myself. A maintainer with a Windows machine will need to look into why these ports are refused. Until then, opencode service set port 49374 is the right workaround; you can go back to the default later with opencode service unset port.
Related: #54267 (the same error message, including a Windows case in its comments) and PR #53355 (fall back to another port when the managed-service port can't be used on Windows).
Thanks for all the checks so far. What you found (45278 and 45280 both refused, nothing listening, not in the excluded ranges, 49374 fine) matches how WSL2 behaves in mirrored networking mode: it reserves a block of about 4,096 ports on Windows, usually 44620–48715, and those ports don't show up in netstat or excludedportrange (microsoft/WSL#12228, microsoft/WSL#40169). Could you tell us:
Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
Did it start right after updating, or after a reboot as well? Does it still happen on 2.0.32 if you run opencode service unset port?
Thanks for all the checks so far. What you found (45278 and 45280 both refused, nothing listening, not in the excluded ranges, 49374 fine) matches how WSL2 behaves in mirrored networking mode: it reserves a block of about 4,096 ports on Windows, usually 44620–48715, and those ports don't show up in netstat or excludedportrange (microsoft/WSL#12228, microsoft/WSL#40169). Could you tell us:
Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
Did it start right after updating, or after a reboot as well? Does it still happen on 2.0.32 if you run opencode service unset port?
Thank you for the reply.
Yes I have WSL2 installed (Ubuntu 22.04), and it's running when this happened.
I was using a VPN, but the proxy was likely turned off at that time (not very sure).
Since it's on my work computer, I have to check the other questions tomorrow. I will also try unset port on 2.0.32 and let you know if it works.
Thanks for all the checks so far. What you found (45278 and 45280 both refused, nothing listening, not in the excluded ranges, 49374 fine) matches how WSL2 behaves in mirrored networking mode: it reserves a block of about 4,096 ports on Windows, usually 44620–48715, and those ports don't show up in netstat or excludedportrange (microsoft/WSL#12228, microsoft/WSL#40169). Could you tell us:
Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
Did it start right after updating, or after a reboot as well? Does it still happen on 2.0.32 if you run opencode service unset port?
Activity
opencode-agent commentedon Oct 16, 2026
Thanks for the report! 2.0.30 moved the default Windows service port (to 45278) to avoid ports that Windows reserves. Your error mentions 45280, which isn't a default, so I'd like to understand what's holding the port. Could you share:
opencode service set port .... Is 45280 one of them? And what error do you get when you runopencodeafter setting a different port? Does it still mention 45280?opencode service get.netstatshows a PID, please also sharetasklist /FI "PID eq <pid>".%USERPROFILE%\.local\share\opencode\log\opencode.log, especially anyERRORlines. Please remove anything private first.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.
These existing issues may be related, ordered by likelihood. Please check whether one of them already covers your problem:
GeZiheng commentedon Oct 16, 2026
opencode service set port 45280. Before setting the port, it shows the same error with port 45278.opencode.log
opencode-agent commentedon Oct 16, 2026
Thanks, that's very helpful. The log gives a clear picture:
service set port. Neither ever starts listening, so this isn't two of our own processes fighting over the port.So Windows reports the port as in use (
EADDRINUSE), and we can't yet see what's holding it. Could you try a few things:tasklist /FI "PID eq <pid>".opencodestarts:opencode service set port 49374 opencodeopencode service set port 8080, and tell us which ports work and which fail.netstatshows nothing on those ports: do you use a firewall, antivirus or VPN tool that could block local listening sockets?In the meantime,
opencode --standaloneshould let you work: it runs a private server instead of the shared background service. To go back to the default port later, runopencode service unset port.Related issues, ordered by likelihood:
GeZiheng commentedon Oct 16, 2026
Thanks, this reply is helpful.
Maybe I will work around with the old port 49374 before this issue is fixed in later versions.
opencode-agent commentedon Oct 16, 2026
Thanks for running all those checks. Your results narrow it down well. On your machine Windows refuses ports 45278 (the new 2.0.30 default) and 45280 as "in use", even though nothing is listening on them and neither is in an excluded port range. The old port 49374 works. The current
devbranch (00e7472) still uses 45278 by default on Windows, so a newer build would most likely behave the same for you.This only happens on Windows, and I can only test on Linux here, so I couldn't reproduce it myself. A maintainer with a Windows machine will need to look into why these ports are refused. Until then,
opencode service set port 49374is the right workaround; you can go back to the default later withopencode service unset port.Related: #54267 (the same error message, including a Windows case in its comments) and PR #53355 (fall back to another port when the managed-service port can't be used on Windows).
neriousy commentedon Oct 19, 2026
Thanks for all the checks so far. What you found (45278 and 45280 both refused, nothing listening, not in the excluded ranges, 49374 fine) matches how WSL2 behaves in mirrored networking mode: it reserves a block of about 4,096 ports on Windows, usually 44620–48715, and those ports don't show up in
netstatorexcludedportrange(microsoft/WSL#12228, microsoft/WSL#40169). Could you tell us:%USERPROFILE%\.wslconfigif the file exists.wsl cat /proc/sys/net/ipv4/ip_local_port_range.opencode service unset port?GeZiheng commentedon Oct 19, 2026
Thank you for the reply.
Since it's on my work computer, I have to check the other questions tomorrow. I will also try unset port on 2.0.32 and let you know if it works.
GeZiheng commentedon Oct 20, 2026
Here are the test results:
opencode service unset port.