Skip to content

in wsl2 [Ubuntu 22.04 LTS] can't start opencode 2.0.12. #50498

Closed as not planned

Description

@sunooms-hue

Description

in wsl2 can't start opencode 2.0.12.

below is the log:
:~/.local/share/opencode/log$ tail -f opencode.log
timestamp=2026-09-22T03:15:02.661Z level=INFO run=94c35f20 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:07.830Z level=INFO run=05f1d131 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:23.262Z level=ERROR run=05f1d131 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:23.548Z level=INFO run=a03c9fef message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:39.906Z level=ERROR run=a03c9fef message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:40.321Z level=INFO run=ca5187e3 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:55.750Z level=ERROR run=ca5187e3 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:15:55.949Z level=INFO run=92660c83 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:11.347Z level=ERROR run=92660c83 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:11.459Z level=INFO run=c4280d6f message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:26.884Z level=ERROR run=c4280d6f message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:27.193Z level=INFO run=cdb6eb19 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:42.605Z level=ERROR run=cdb6eb19 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:43.029Z level=INFO run=543f522a message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:58.468Z level=ERROR run=543f522a message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:16:58.755Z level=INFO run=7571c301 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:17:02.858Z level=ERROR run=0875123b message="cli process failed" cause="Cause([Fail(Error: Timed out waiting for the background service to start)])" args=[] role=cli
timestamp=2026-09-22T03:17:14.175Z level=ERROR run=7571c301 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:20:17.350Z level=INFO run=4109a5c0 message="cli starting" version=2.0.12 channel=latest local=false args=[] role=cli
timestamp=2026-09-22T03:20:17.436Z level=INFO run=4109a5c0 message="background service starting" reason=missing previousVersion=undefined role=cli
timestamp=2026-09-22T03:20:17.504Z level=INFO run=d23e6709 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli

timestamp=2026-09-22T03:20:22.716Z level=INFO run=d7160145 message="cli starting" version=2.0.12 channel=latest local=false args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:20:38.159Z level=ERROR run=d7160145 message="cli process failed" cause="Cause([Fail(Error: Managed service port 49375 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. (cause: ServeError (cause: Error: Failed to start server. Is port 49375 in use?)))])" args="["serve","--service"]" role=cli
timestamp=2026-09-22T03:21:12.259Z level=INFO run=046a2f26 message="cli starting" version=2.0.12 channel=latest local=false args="["upgrade","next"]" role=cli

Plugins

No response

OpenCode version

$ opencode --version
opencode v2.0.12

Steps to reproduce

pkill -9 -f opencode || true
rm -rf ~/.local/share/opencode/service
rm -rf ~/.cache/opencode
opencode

Screenshot and/or share link

No response

Operating System

wsl2 Ubuntu 22.04.5 LTS \n \l

Terminal

powershell 7.6.6

Activity

  1. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • OpenCode version is blank — please specify the exact version (the logs show 2.0.12, but please confirm via opencode --version)
    • Operating System is blank — please include your WSL2 distro, Windows version, and architecture
    • Terminal is blank — please specify the terminal you are using
    • Steps to reproduce is blank — please describe what you were doing when this started (e.g. first run, after an update, after a crash, something else occupying port 49375)

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Sep 22, 2026
  3. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now includes the necessary details — a clear description, log output, steps to reproduce, version, and OS info. We appreciate you taking the time to fill everything out properly.

  4. changed the title [-]in wsl2 can't start opencode 2.0.12.[/-] [+]in wsl2 [Ubuntu 22.04 LTS] can't start opencode 2.0.12.[/+] on Sep 22, 2026
  5. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    Sorry this hasn't been picked up yet. The log shows new serve --service processes failing every ~16 seconds, which usually means a service is already running but the new launch can't reach or recognize it. Could you tell us:

    1. Does this still happen on the latest version (2.0.32)?
    2. Your %USERPROFILE%\.wslconfig on Windows (especially networkingMode and autoProxy).
    3. The output of env | grep -i proxy inside WSL. If proxies are set, does NO_PROXY=127.0.0.1,localhost opencode start?
    4. Is OpenCode (Desktop or CLI) also running on the Windows side at the same time?
    5. Which plugins and MCP servers are in your config?
  6. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the logs! Each serve --service attempt fails because something already holds 127.0.0.1:49375 and it isn't an OpenCode service the CLI recognises, so it keeps retrying. To find out what is holding the port, could you reply to the earlier questions from @neriousy and also add:

    1. Whether it still happens after upgrading to the latest 2.x release. Newer versions name the process holding the port in this error, so please paste the new error text.
    2. The output of opencode service get. 49375 isn't the default port for the release channel (49374), so we'd like to know whether it was set by hand.
    3. The output of these commands inside WSL:
      cat /proc/sys/net/ipv4/ip_local_port_range
      ss -ltnp | grep 4937
    4. Your %USERPROFILE%\.wslconfig (especially networkingMode), and whether OpenCode Desktop or the Windows CLI is running at the same time.

    As a test, you could also try a port below 32768, e.g. opencode service set port 28894, then run opencode again and tell us whether it starts. With WSL mirrored networking, Windows and WSL can reserve ports that look "in use" even though nothing is listening on them.

    You can reply here or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know when you're done.

    Related issues, ordered by likelihood:

  7. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    We're closing this for now because we haven't heard back. To find out what is holding port 49375 in WSL2, we still need the details asked for above: whether it happens on the latest 2.x release (newer versions name the process holding the port in the error), the output of opencode service get, cat /proc/sys/net/ipv4/ip_local_port_range and ss -ltnp | grep 4937, and your .wslconfig networking mode.

    In the meantime, a port below 32768 may get you running, e.g. opencode service set port 28894.

    If it still happens, reply here with those details and we can reopen it. Related: #55907, #55918.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions