Skip to content

Desktop App: Daemon crashes on startup (exit code 1) - liveness-fd pipe closes prematurely on Windows #850

@harshit-aristocrat

Description

@harshit-aristocrat

Environment

  • OS: Windows 10 (10.0.26100)
  • Factory Desktop: v0.41.0 (also reproduced on v0.40.0)
  • Droid binary: v0.86.0
  • CLI droid: v0.86.0 (works fine)

Symptom

The desktop app spawns the daemon with:

droid.exe daemon --droid-path <path> --enable-code-server --remote-access --liveness-fd 3

The daemon crashes with exit code 1 within 6-8 seconds of spawning. The desktop retries 3 times then gives up with "Crashed too many times, giving up".

The desktop app UI loads but shows no active daemon/sessions.

Root Cause Analysis

  1. Daemon works perfectly when run manually:

    droid.exe daemon --debug --port 9999 --enable-code-server --remote-access
    

    Starts and stays running indefinitely with full WebSocket connectivity.

  2. The --liveness-fd 3 flag is the trigger. When tested with --liveness-fd 0 (stdin), the daemon starts successfully but shuts down immediately when the pipe closes -- confirming fd monitoring logic works correctly.

  3. The desktop app's liveness pipe on fd 3 appears to close prematurely, causing the daemon to detect parent disconnect and exit.

  4. No port conflicts -- port 8080 is free, no stale processes blocking.

  5. No antivirus interference detected.

  6. Daemon produces zero stderr/stdout when crashing via desktop, making diagnosis difficult.

Logs

From %APPDATA%\Factory\logs\desktop-droid.log:

[2026-03-26T01:25:17.179Z] INFO: [daemon] Starting daemon
[2026-03-26T01:25:17.216Z] INFO: [daemon] Process spawned | pid: 101256
[2026-03-26T01:25:19.234Z] WARN: [daemon] Health check failed | attempt: 1
[2026-03-26T01:25:21.241Z] WARN: [daemon] Health check failed | attempt: 2
[2026-03-26T01:25:23.401Z] WARN: [daemon] Exited unexpectedly | code: 1
[2026-03-26T01:25:23.401Z] INFO: [daemon] Scheduling restart | attempt: 1
... (repeats 3 times, then gives up)

Workaround

The droid CLI from the terminal works fine -- only the desktop app daemon launch is broken.

Steps to Reproduce

  1. Install Factory Desktop v0.41.0 on Windows 10
  2. Launch the desktop app
  3. Observe daemon crash loop in desktop-droid.log
  4. Confirm daemon works standalone: droid.exe daemon --debug --port 9999

Metadata

Metadata

Assignees

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