Skip to content

TUI hangs at "Starting background server..." when Desktop app is installed #57978

Open

Description

@WangZhongDian

Description

Summary

When both the OpenCode Desktop app and TUI are installed, the TUI cannot start its background service if the Desktop app has been launched before. opencode service status reports stopped. After closing the Desktop app and killing the service process, starting from the TUI hangs indefinitely at:

opencode
Starting background server...

If the Desktop app is then started again, the TUI immediately reports an error mentioning:

49374 on 0.0.0.0 is already ...

However, before restarting the Desktop app, port 49374 should be free, so the TUI should be able to start the background server immediately. Instead, it hangs indefinitely.

Manually running opencode serve --service starts normally. This suggests the issue is specific to how the single opencode command launches opencode serve --service, rather than the service command itself.

Environment

  • OpenCode version: 2.1.2
  • Installation: Desktop app + TUI both installed
  • OS: ubuntu24.04 amd
  • Shell: bash
  • Desktop app version: 2.1.2

Steps to Reproduce

Expected Behavior

  • If port 49374 is free, the TUI should start the background server successfully.
  • If the port is occupied, the TUI should fail fast with a clear error instead of hanging indefinitely.
  • opencode service status should reflect the actual service state.
  • Starting the TUI should behave consistently with manually running opencode serve --service.

Plugins

None

OpenCode version

2.1.2

Steps to reproduce

  1. Install both OpenCode Desktop and OpenCode TUI.
  2. Start the Desktop app.
  3. Try to start the TUI.
  4. Observe that the TUI cannot start.
  5. Run opencode service status; it reports stopped.
  6. Close the Desktop app and kill the related service process.
  7. Confirm that port 49374 is free, e.g.:
lsof -i :49374
  1. Start OpenCode from the TUI.
  2. Observe that it hangs indefinitely at:
opencode
Starting background server...
  1. While the TUI is still hanging, start the Desktop app again.
  2. Observe that the TUI immediately reports an error similar to:
49374 on 0.0.0.0 is already ...

Screenshot

Image

Operating System

ubuntu24.04 amd

Terminal

bash

Activity

  1. changed the title [-]TUI hangs indefinitely at “Starting background server...” when Desktop and TUI are both installed; manual opencode serve --service works[/-] [+]TUI hangs at "Starting background server..." when Desktop app is installed[/+] on Oct 22, 2026
  2. opencode-agent commented on Oct 22, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I tried to reproduce this with the 2.1.2 CLI on Linux, but I couldn't run the Desktop app here, and that seems to be what triggers it. Without Desktop, the TUI started the background server normally every time I tried, including:

    • with hostname set to 0.0.0.0 in the service config (the address in your error)
    • after force-killing the service process and leaving its registration file behind

    So this needs a maintainer who can run Desktop 2.1.2 on Linux. These would help them track it down:

    • The output of opencode service get, and the contents of ~/.config/opencode/service.json and ~/.local/state/opencode/service.json after you have launched the Desktop app (please remove the password value).
    • While the TUI is hanging: the output of ps aux | grep opencode, and the most recent entries from ~/.local/share/opencode/log/opencode.log around that time.
    • Whether running opencode service start in that same state also hangs or prints an error.

    Closely related issues, most likely first:

  3. WangZhongDian commented on Oct 22, 2026

    @WangZhongDian
    Author
    $ opencode service get
    {
      "remote": {},
      "hostname": "0.0.0.0"
    }
    
    $ ps aux | grep opencode
    jiuji    3215871  2.2  1.0 15940480 660832 ?     Ssl  09:24   1:42 /home/jiuji/.opencode/bin/opencode serve --service
    jiuji    3218025  0.1  0.5 1518642508 363584 ?   Sl   09:24   0:04 /opt/OpenCode/ai.opencode.desktop
    jiuji    3218030  0.0  0.0 55094584 57380 ?      S    09:24   0:00 /opt/OpenCode/ai.opencode.desktop --type=zygote --no-zygote-sandbox
    jiuji    3218031  0.0  0.0 55094576 57228 ?      S    09:24   0:00 /opt/OpenCode/ai.opencode.desktop --type=zygote
    jiuji    3218033  0.0  0.0 55094600 14220 ?      S    09:24   0:00 /opt/OpenCode/ai.opencode.desktop --type=zygote
    jiuji    3218062  4.7  0.5 55852632 332816 ?     Sl   09:24   3:31 /opt/OpenCode/ai.opencode.desktop --type=gpu-process --ozone-platform=x11 --enable-crash-reporter=a4b71de6-104d-48c3-accf-1faeaf920a02,no_channel --user-data-dir=/home/jiuji/.config/ai.opencode.desktop --gpu-preferences=YAAAAAAAAAAgAQAEAAAAAAAAAAAAAGAASAAAAAAAAAABAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAEAAAAAAAAACAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA== --shared-files --field-trial-handle=3,i,13578186281647448250,8006573349302797024,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,15381693014225495627,12096977021767217140,4 --trace-process-track-uuid=3190708988185955192
    jiuji    3218064  0.0  0.1 54925252 92800 ?      Sl   09:24   0:02 /opt/OpenCode/ai.opencode.desktop --type=utility --utility-sub-type=network.mojom.NetworkService --lang=zh-CN --service-sandbox-type=none --enable-crash-reporter=a4b71de6-104d-48c3-accf-1faeaf920a02,no_channel --user-data-dir=/home/jiuji/.config/ai.opencode.desktop --standard-schemes=oc --secure-schemes=oc --cors-schemes=oc --fetch-schemes=oc --streaming-schemes=oc --code-cache-schemes=oc --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13578186281647448250,8006573349302797024,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,15381693014225495627,12096977021767217140,4 --trace-process-track-uuid=3190708989122997041
    jiuji    3218088  8.3  0.6 1524731316 417252 ?   Sl   09:24   6:07 /opt/OpenCode/ai.opencode.desktop --type=renderer --enable-crash-reporter=a4b71de6-104d-48c3-accf-1faeaf920a02,no_channel --user-data-dir=/home/jiuji/.config/ai.opencode.desktop --standard-schemes=oc --secure-schemes=oc --cors-schemes=oc --fetch-schemes=oc --streaming-schemes=oc --code-cache-schemes=oc --app-path=/opt/OpenCode/resources/app.asar --enable-sandbox --ozone-platform=x11 --lang=zh-CN --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=5 --launch-time-ticks=664174659107 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13578186281647448250,8006573349302797024,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,15381693014225495627,12096977021767217140,4 --trace-process-track-uuid=3190708990997080739 --opencode-window=%7B%22id%22%3A%225641b7af-8e6c-4e81-801a-f19be304c641%22%2C%22firstLaunchPending%22%3Afalse%2C%22packaged%22%3Atrue%7D
    jiuji    3218220  0.0  0.0 55466216 42220 ?      S    09:24   0:00 /opt/OpenCode/ai.opencode.desktop --type=broker
    jiuji    3218357  0.0  0.0 54544520 4484 ?       Sl   09:24   0:00 /opt/OpenCode/chrome_crashpad_handler --monitor-self-annotation=ptype=crashpad-handler --no-rate-limit --database=/home/jiuji/.config/ai.opencode.desktop/Crashpad --annotation=_productName=OpenCode --annotation=_version=2.1.2 --annotation=lsb-release=Ubuntu 24.04.5 LTS --annotation=plat=Linux --annotation=prod=Electron --annotation=ver=44.9.1 --initial-client-fd=113 --shared-client-connection
    jiuji    3480913  0.0  0.1 54961928 74216 ?      Sl   10:28   0:00 /opt/OpenCode/ai.opencode.desktop --type=utility --utility-sub-type=audio.mojom.AudioService --lang=zh-CN --service-sandbox-type=none --crashpad-handler-pid=3218357 --enable-crash-reporter=a4b71de6-104d-48c3-accf-1faeaf920a02,no_channel --user-data-dir=/home/jiuji/.config/ai.opencode.desktop --standard-schemes=oc --secure-schemes=oc --cors-schemes=oc --fetch-schemes=oc --streaming-schemes=oc --code-cache-schemes=oc --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,13578186281647448250,8006573349302797024,262144 --enable-features=DocumentPolicyIncludeJSCallStacksInCrashReports,PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,15381693014225495627,12096977021767217140,4 --trace-process-track-uuid=3190708991934122588
    jiuji    3619181  0.8  0.1 6944292 96516 pts/11  Sl+  10:38   0:00 opencode service start
    jiuji    3619828  2.4  0.2 6944292 148580 ?      Ssl  10:38   0:00 /home/jiuji/.opencode/bin/opencode serve --service
    jiuji    3620014  6.0  0.2 6944292 149820 ?      Ssl  10:38   0:00 /home/jiuji/.opencode/bin/opencode serve --service
    jiuji    3620085  0.0  0.0  11280  2460 pts/7    S+   10:38   0:00 grep --color=auto opencode
    

    Can the desktop and TUI not share the same backend service?

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