Skip to content

[desktop] "Could not start bb" most of the time #2480

Closed

Description

@mateusscheper

Summary

Whenever I open the desktop application, it says:

Could not start bb

Port http://127.0.0.1:38886 is responding, but it does not look like bb: /api/v1/system/config returned This operation was aborted. Logs are under /home/{redacted}/.bb/logs/.

  bb
o Starting server
✓ Server listening on http://127.0.0.1:38886
o Starting host daemon

The port 38886 is not open, as the error wrongly states.

After closing and reopening a bunch of times, it randomly works.
Seems like a timing issue.

Versions and environment

bb 0.48, desktop.
Linux Mint 22.2 Cinnamon.

Steps to reproduce

  1. Open the AppImage
  2. See the issue.
  3. Close and reopen a bunch of times
  4. See the issue or see it working.

Expected vs actual

.

Evidence

server.1.log:

{"level":30,"time":1787751254799,"component":"server","bindHost":"127.0.0.1","port":38886,"dataDir":"/home/{redacted}/.bb","msg":"Server listening"}
{"level":30,"time":1787751255680,"component":"server","msg":"plugin [email protected] loaded"}
{"level":30,"time":1787751256152,"component":"server","msg":"plugin [email protected] loaded"}

host-daemon.1.log when it failed:

{"level":30,"time":1787679892565,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","count":1,"sessions":[{"environmentId":"env_kkmp3dm64d","idleForMs":1965781,"providerId":"codex","threadId":"thr_w5xstb6dey"}],"msg":"Reaped idle provider sessions"}
{"level":30,"time":1787680192462,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","count":1,"sessions":[{"environmentId":"env_8s9pd55trj","idleForMs":1877371,"providerId":"codex","threadId":"thr_6rq8ph7xcz"}],"msg":"Reaped idle provider sessions"}
{"level":30,"time":1787680492559,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","count":1,"sessions":[{"environmentId":"env_4xjm24m5pu","idleForMs":1870776,"providerId":"codex","threadId":"thr_yeqdi7yfvw"}],"msg":"Reaped idle provider sessions"}
{"level":30,"time":1787680794186,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","mode":"shutdown","reason":"SIGTERM","msg":"Shutting down host daemon"}
{"level":30,"time":1787680794201,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","code":1001,"reason":"server-shutdown","msg":"Disconnected from server"}
{"level":40,"time":1787680795202,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","err":{"type":"i$r","message":"fetch failed","error":{"type":"Error","message":"fetch failed","stack":"Error: fetch failed\n    at file:///tmp/.mount_bb-deslrbghO/resources/app.asar.unpacked/node_modules/bb-app/host-daemon/dist/daemon-bundle.mjs:743:337\n    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)"},"target":null,"currentTarget":null,"srcElement":null,"cancelable":false,"defaultPrevented":false,"timeStamp":16504113.287997,"returnValue":true,"bubbles":false,"composed":false,"eventPhase":0,"cancelBubble":false,"isTrusted":false},"msg":"WebSocket error"}

host-daemon.1.log when it opened successfully:

{"level":30,"time":1787751359899,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","dataDir":"/home/{redacted}/.bb","serverUrl":"http://127.0.0.1:38886","msg":"Host daemon connecting"}
{"level":30,"time":1787751360254,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","sessionId":"hses_da6gjp8j4t","msg":"Connected to server"}
{"level":30,"time":1787751360254,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","identity":{"hostId":"host_gsby8x555t","hostName":"Notebook","instanceId":"c724efa5-0fae-493a-bd4b-952a38010df6"},"msg":"Host daemon started"}
{"level":30,"time":1787751362062,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","pluginId":"keep-awake","startupDurationMs":118,"msg":"Host plugin worker ready"}
{"level":30,"time":1787751362246,"component":"host-daemon","serverUrl":"http://127.0.0.1:38886","pluginId":"provider-acp","startupDurationMs":187,"msg":"Host plugin worker ready"}

What you ruled out

Command sudo netstat -nlp | grep 38886 doesn't return anything, meaning nothing is running on port 38886.
Also, nmap -v localhost -p38886 shows it closed.

Suggested priority and effort (optional)

No response

Checks

  • I reproduced this on the latest release or on main, or I say above that I could not.
  • I searched open and closed issues for the same problem.
  • If an agent wrote this, the body ends with > AGENT GENERATED and links the thread or report.

Activity

  1. added theissue type on Aug 26, 2026
  2. added
    desktop
    on Aug 26, 2026
  3. SawyerHood commented on Aug 27, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2480.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): The desktop probe marks a temporary config request abort as incompatible and stops before its wait loop can retry.
    • Proposed fix: Classify system-config network failures as unavailable, and retry them before the startup deadline. Keep HTTP and schema failures incompatible. Use a request timeout separate from the 250 ms poll interval.
    • Caveats: The investigation did not run the reporter's Linux Mint AppImage or capture a screenshot. It reproduced the exact probe result with a deterministic loopback test. The initial install failed because /tmp had no free inodes, so the desktop build used the initial checkout dependency tree.

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by GPT-5.6-Sol

  4. added
    confirmed-repro
    on Aug 27, 2026
  5. palashkaria commented on Aug 28, 2026

    @palashkaria

    Same thing on macOS, so it's not Linux-specific. bb 0.40.0 desktop app, macOS 26 (Darwin 25.4), Apple Silicon. It happened on the very first launch after install (~/.bb was created the same minute).

    The logs match the report above. server.1.log: "Server listening" at t=0, then plugins loading one at a time for about 2 s. host-daemon.1.log: the daemon connects at t+1.6 s and gets SIGTERM 12 ms later. Nothing crashed, the app just gave up on the server.

    One extra data point that explains why the config request goes past 250 ms. I ran the bundled server by hand (ELECTRON_RUN_AS_NODE=1 /Applications/bb.app/Contents/MacOS/bb dist/bb-app.js --data-dir <scratch> --server-port 38899) and hit both endpoints every 100 ms with a 250 ms timeout. At t+612 ms I caught the exact failing combination (/health answered in 0.7 ms, /api/v1/system/config timed out), and the server itself logged:

    Event loop stalled {"intervalMs":5000,"maxDelayMs":977.8,"meanDelayMs":30,"p99DelayMs":249.2,"thresholdMs":500,"lastWork":"GET /api/v1/system/config","lastWorkMs":0.6,...}
    

    So the handler is fast (0.6 ms), but plugin loading blocks the event loop for up to ~1 s right after the port opens, and whether a 250 ms probe lands inside a stall is luck. That's the "randomly works" part. Simulating the shell's poll loop against the real server passed 9/9 for me, warm and cold, so on a quiet machine the window is small. A first launch (DB migrations plus plugin install) with Electron itself still spinning up is what widens it.

    Workaround until the fix lands: start the server first, then open the app. The attach path gives the probe 1.5 s, and the server answers in about 1 ms once plugins are loaded.

    cd /Applications/bb.app/Contents/Resources/app.asar.unpacked/node_modules/bb-app
    ELECTRON_RUN_AS_NODE=1 BB_APP_SURFACE=desktop /Applications/bb.app/Contents/MacOS/bb dist/bb-app.js
    

    On Linux the same folder lives inside the AppImage mount under resources/app.asar.unpacked/node_modules/bb-app.

    +1 to the proposed fix: treat an aborted config fetch as "not ready yet, try again" rather than "not bb", and give the request its own timeout instead of reusing the 250 ms poll interval.

    AGENT GENERATED: investigated and drafted by Claude Code (Fable 5) in @palashkaria's session; posted by the user. No public report link.

  6. SawyerHood commented on Sep 9, 2026

    @SawyerHood
    Collaborator

    Closing as completed on main: #3293 fixes the startup-probe failure path matching this report's /api/v1/system/config returned This operation was aborted error.

    A successful health probe followed by a transient config-probe network failure is now treated as temporarily unavailable and retried, rather than as proof of an incompatible non-BB server that causes Desktop to stop its own starting runtime. Actual HTTP/schema evidence of an incompatible service still fails immediately.

    Merged September 8, 2026. This fix is on main but is not included in desktop-v0.42.1. The PR records a regression for health-success/config-abort/next-probe-success and five consecutive rebuilt AppImage lifecycle smoke passes.

    This closes the matching probe-classification defect, not every possible cause of desktop startup failure.

    AGENT GENERATED

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

    confirmed-reprodesktop

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions