Skip to content

[Bug]: Desktop backend reports ready but Electron API requests time out on WSL2 #43429

Closed as not planned

Description

@dfty99

Bug Description

Hermes Desktop fails to complete startup inside WSL2.

The Electron application launches successfully, and the Desktop log reports that the local Hermes backend is ready:

[hermes] [boot] Resolving Hermes backend
[hermes] [boot] Finding an open local port
[hermes] [boot] Resolving Hermes runtime
[hermes] [boot] Using existing Hermes CLI at /home/dfty99/.local/bin/hermes
[hermes] [boot] Starting Hermes backend via existing Hermes CLI at /home/dfty99/.local/bin/hermes
[hermes] [boot] Waiting for Hermes backend to become ready
[hermes] [boot] Hermes backend is ready. Finalizing desktop startup

However, the Electron process repeatedly reports:

Error occurred in handler for 'hermes:api': Error: Timed out connecting to Hermes backend after 15000ms

The Hermes TUI and Web Dashboard both work normally on the same installation.

Stopping the Dashboard, disabling VPN/TUN mode, clearing Electron configuration, and rebuilding the Desktop application do not change the behavior.

Steps to Reproduce

Install or upgrade Hermes Agent to v0.16.0 inside WSL2.

Confirm that the TUI works:

hermes

Confirm that the Dashboard works:

hermes dashboard
Stop the Dashboard.

Launch Desktop:

hermes desktop
Observe that the Electron window launches but cannot communicate with the backend.
Observe repeated 15-second API timeout errors in the terminal.

Expected Behavior

After the Desktop log reports:

Hermes backend is ready. Finalizing desktop startup

the Electron renderer should connect to the backend and display a usable Desktop interface.

Actual Behavior

The backend readiness check succeeds, but Electron IPC/API requests repeatedly time out:

Error occurred in handler for 'hermes:api': Error: Timed out connecting to Hermes backend after 15000ms

The terminal also shows:

Failed to connect to socket /run/user/1000/bus: No such file or directory

The Electron window itself launches, so it is unclear whether the DBus warnings are relevant.

Affected Component

Other

Messaging Platform (if gateway-related)

No response

Debug Report

Report:
https://paste.rs/E9NWc

agent.log:
https://dpaste.com/FAVFBF7K6

gateway.log:
https://dpaste.com/C88YEUVXN

desktop.log:
https://paste.rs/3PhRv

These debug links expire automatically after 6 hours.

Operating System

Ubuntu 24.04.3 LTS on WSL2 (Windows 11 build 10.0.26200.8457)

Python Version

3.11.15

Hermes Version

0.16.0 (2026.6.5)

Additional Logs / Traceback (optional)

The Desktop backend reports that it is ready, but Electron API requests still time out:


[hermes] [boot] Hermes backend is ready. Finalizing desktop startup

Error occurred in handler for 'hermes:api':
Error: Timed out connecting to Hermes backend after 15000ms


The terminal also reports:


Failed to connect to socket /run/user/1000/bus: No such file or directory


The TUI and `hermes dashboard` both work normally on the same installation.

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    comp/gatewayGateway runner, session dispatch, delivery
    P3Low — cosmetic, nice to have
    on Jun 10, 2026
  2. m0st4f4-hub commented on Jun 11, 2026

    @m0st4f4-hub

    Same race on native Windows 11 (not WSL)

    Reproduction steps on Windows 10/11 (PowerShell, no WSL involved):

    1. Fresh install via install-main.ps1 — fails at desktop stage with Expected "0.28.0" but got "0.27.7" (lockfile/esbuild). Mitigated by cherry-picking fix: sync npm lockfile node types #44024.
    2. After lockfile fix, bootstrap completes, marker .hermes-bootstrap-complete is written.
    3. hermes dashboard itself crashes with Windows fatal exception 0xC0000005 in os.execvpe (hermes_cli/main.py). Mitigated by cherry-picking fix(cli): skip dashboard re-exec on Windows to avoid execvpe segfault #44355 (the sys.platform == "win32" guard).
    4. With both fixes plus web_dist pre-built, launch packaged Hermes.exe (apps/desktop/release/win-unpacked/Hermes.exe).

    logs/desktop.log reports a clean handshake:

    [boot] Resolving Hermes runtime
    [boot] Hermes runtime is ready
    [boot] Starting Hermes backend via Hermes at <root> (venv: <root>/venv)
    [boot] Waiting for Hermes backend to become ready
    [boot] Hermes backend is ready. Finalizing desktop startup
    [renderer console] Blocked call to navigator.vibrate ...
    

    So main.cjs's waitForBackendReady returns success, and the renderer loads. Despite that, ~60s later the renderer surfaces:

    Error invoking remote method 'hermes:api':
    Error: Timed out connecting to Hermes backend after 60000ms
    

    (Identical dialog "Hermes couldn't start - The background gateway didn't come up" with Retry / Repair install / Use local gateway / Open logs.)

    Backend is actually up the entire time

    Probing port 9120 directly while the dialog is showing, all from native Windows:

    [200] http://127.0.0.1:9120/         ← Web UI HTML (uvicorn serving)
    [200] http://127.0.0.1:9120/healthz  ← Healthcheck OK
    [401] http://127.0.0.1:9120/api/health    ← Auth gate (correct)
    [401] http://127.0.0.1:9120/api/v1/health ← Auth gate (correct)
    

    Process tree at the moment of timeout:

    Hermes.exe (Electron main + GPU + utility + 2 renderers)  ← all healthy
    python.exe (venv shim, idle)                              ← launched hermes_cli.main
    python.exe (uv-managed cpython 3.11.13, owns 9120)        ← real gateway
    

    So the discrepancy isn't backend death; it's that main.cjs's readiness probe (the one that prints "Hermes backend is ready") and the IPC handler that backs hermes:api use different ready conditions, and the IPC handler's first request races the gateway's middleware/auth init, then sits on a 60s timeout.

    Clicking Retry on the dialog connects instantly because the second request hits the now-warm uvicorn worker.

    Suggested upstream fix (sketch)

    Either:

    • Make main.cjs's waitForBackendReady (~line 2520-3790, three call sites that throw "Timed out connecting to Hermes backend after ${timeoutMs}ms") wait for an authenticated round-trip on the same code path the hermes:api IPC handler uses, instead of the cheaper liveness probe; or
    • Have the hermes:api IPC handler short-circuit the timeout while waitForBackendReady is still pending, retry once after backoff, and only surface the dialog after N retries.

    Either way the symptom — "boot says ready, first IPC times out 60s later, Retry fixes it" — should disappear.

    Environment

  3. teknium1 commented on Jul 14, 2026

    @teknium1
    Collaborator

    Thanks for the detailed WSL2 report. This is already fixed on current main by the Desktop startup-timeout work; the native-Windows follow-up's cross-reference to #48504 matches that fix.

    Automated hermes-sweeper review:

    • 4aad27b751dd764bd32aa56fca8375846a0fdba3 (fix(desktop): extend startup long-timeout to the whole boot data burst) explicitly fixes [Bug]: Desktop remote startup fails when profile listing exceeds hardcoded 15s API timeout #48504.
    • apps/desktop/src/hermes.ts:60-71 defines the 60-second startup request timeout for the post-readiness boot burst that previously produced the 15-second backend timeout.
    • apps/desktop/src/hermes.test.ts:96-124 verifies the long timeout for boot data requests while retaining the short /api/status liveness probe.
    • The fix is included in v2026.7.7.
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

    P3Low — cosmetic, nice to havecomp/gatewayGateway runner, session dispatch, deliverysweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions