Skip to content

Failed to launch after updated to 2.0.30 #56005

Closed

Description

@GeZiheng

Description

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.

Plugins

CLI

OpenCode version

2.0.30

Steps to reproduce

  1. Update to version 2.0.30.
  2. Launch opencode in powershell.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Powershell

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    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:

    1. 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?
    2. The output of opencode service get.
    3. 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>".
    4. 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:

  2. GeZiheng commented on Oct 16, 2026

    @GeZiheng
    Author

    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:

    1. 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?

    2. The output of opencode service get.

    3. 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>".

    4. 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:

    1. Yes, I set opencode service set port 45280. Before setting the port, it shows the same error with port 45278.
    2. Output:
    {
      "port": 45280
    }
    
    1. Output:
    协议 tcp 端口排除范围
    
    开始端口    结束端口      
    ----------    --------      
          2869        2869      
          5357        5357      
          8884        8884      
         27339       27339      
         50000       50059     *
    
    * - 管理的端口排除。
    
    1. The log file is attached.

    opencode.log

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    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:

    1. 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>".
    2. 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.
    3. 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.

    Related issues, ordered by likelihood:

  4. GeZiheng commented on Oct 16, 2026

    @GeZiheng
    Author

    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:

    1. 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>".

    2. 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.

    3. 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.

    Related issues, ordered by likelihood:

    Thanks, this reply is helpful.

    1. The output is empty.
    2. Yes, this port works.
    3. Either I turn the VPN on/off, it always shows nothing.

    Maybe I will work around with the old port 49374 before this issue is fixed in later versions.

  5. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    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).

  6. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    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:

    1. Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
    2. The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
    3. Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
    4. 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?
  7. GeZiheng commented on Oct 19, 2026

    @GeZiheng
    Author

    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:

    1. Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
    2. The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
    3. Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
    4. 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.

    1. Yes I have WSL2 installed (Ubuntu 22.04), and it's running when this happened.
    2. 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.

  8. GeZiheng commented on Oct 20, 2026

    @GeZiheng
    Author

    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:

    1. Do you have WSL installed, and was a distro running when this happened? Please paste the contents of %USERPROFILE%\.wslconfig if the file exists.
    2. The output of wsl cat /proc/sys/net/ipv4/ip_local_port_range.
    3. Do you use Docker Desktop, a VPN, or a proxy tool (Clash, v2ray, etc.)?
    4. 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?

    Here are the test results:

    1. Contents
    [experimental]
    autoMemoryReclaim=gradual  
    networkingMode=mirrored
    dnsTunneling=true
    firewall=true
    autoProxy=true
    
    1. 44620 48715
    2. Today I updated to 2.1.0, and it happens again after I run opencode service unset port.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions