Skip to content

[v2 Windows] opencode2 hangs at "Starting background server..." after reinstall #41746

Description

@antigravity-unleashed

Description

Steps to reproduce:

  1. npm uninstall -g @opencode-ai/cli
  2. npm install -g @opencode-ai/cli@0.0.0-next-17155
  3. Run opencode2 → hangs at "Starting background server..."

Additional notes:

  • Running opencode2 serve directly works fine (starts on port 4096)
  • opencode2 --standalone works correctly
  • The issue appears to be in how the TUI spawns the background server process

Plugins

No response

OpenCode version

opencode2 v0.0.0-next-17155 

Steps to reproduce

Screenshot and/or share link

No response

Operating System

OS: Windows

Terminal

PowerShell

Activity

  1. github-actions commented on Aug 11, 2026

    @github-actions
    Contributor

    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.

  2. opencode-agent commented on Aug 11, 2026

    @opencode-agent
    Contributor

    Thanks for the report. Could you reproduce this once more and share the relevant log output?

    On Windows, the installed-build log is at:

    %USERPROFILE%\.local\share\opencode\log\opencode.log
    

    Please redact API keys, authorization headers, prompts, file contents, and any other sensitive data before sharing it.

  3. Double77x commented on Sep 7, 2026

    @Double77x

    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:

    1. Surface stderr from the background service in the CLI rather than silently waiting for the timeout.
    2. Retry with an alternate port (or request port 0 and persist what the OS assigns) when hitting EADDRINUSE / WSAEACCES.
  4. added a commit that references this issue on Sep 7, 2026
    7487028
  5. humb1t commented on Sep 16, 2026

    @humb1t

    I get same issue on linux machine today

  6. laundry-96 commented on Oct 7, 2026

    @laundry-96

    I'm getting the same issue. I have multiple users on my server, so the port can be blocked by other people

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