Skip to content

Windows: daemon start/doctor time out with ENOENT because IPC uses a filesystem socket (0.2.0) #1051

Closed

Description

@randroid88

What happened

On native Windows PowerShell, the published [email protected] package cannot start its daemon. Both doctor variants fail before diagnostics can run, and an explicit daemon start fails the same way.

The CLI reports a missing socket, while the daemon log shows that binding the endpoint actually failed with EACCES. Repeating startup also leaves failed daemon node.exe processes running after the CLI times out.

There is a second Windows compatibility problem: the installed Android SDK is skipped as "missing or incomplete" because discovery checks for Unix tool filenames. Fixing only IPC makes doctor return an empty findings list even though no Android driver was loaded.

What you expected

The daemon should start using a Windows-compatible IPC endpoint, and Android SDK discovery should recognize the Windows SDK tools. If native Windows is unsupported, the CLI should report that explicitly rather than timing out with a missing-socket error.

How to reproduce

In native Windows PowerShell:

npm install --global simlock@0.2.0
simlock doctor
simlock doctor --fix
simlock daemon start
simlock daemon stop

The first three Simlock commands each produced the startup timeout below. daemon stop produced a direct connect ENOENT error because no daemon endpoint was available.

For Android SDK discovery, the machine already has ANDROID_HOME and ANDROID_SDK_ROOT pointing to a complete SDK containing:

platform-tools\adb.exe
emulator\emulator.exe
cmdline-tools\latest\bin\avdmanager.bat
cmdline-tools\latest\bin\sdkmanager.bat
system-images\android-36\default\x86_64

Environment

  • Simlock: npm package [email protected], installed globally.
  • OS: Windows 11 Pro, version 10.0.26200, x64.
  • Shell: Windows PowerShell 5.1.26100.9711 (Desktop).
  • Node.js: v24.18.0.
  • npm: 12.0.2.
  • Target platform: Android.
  • These findings were reproduced against the published 0.2.0 package; current repository main was not tested.

Logs and evidence

User-directory names are redacted below.

CLI output from simlock doctor, simlock doctor --fix, and simlock daemon start:

{"error":{"code":"INTERNAL","message":"Timed out starting simlock daemon: connect ENOENT C:\\Users\\<user>\\.simlock\\daemon.sock"}}

Relevant original daemon.log entries:

{"level":"warn","module":"daemon.driver-discovery","message":"Skipped Android driver: SDK missing","fields":{"reason":"Android SDK missing or incomplete; searched: C:\\Users\\<user>\\AppData\\Local\\Android\\Sdk, C:\\Users\\<user>\\AppData\\Local\\Android\\Sdk, C:\\Users\\<user>/Library/Android/sdk"}}
{"level":"error","module":"daemon","message":"Daemon failed to start","fields":{"message":"listen EACCES: permission denied C:\\Users\\<user>\\.simlock\\daemon.sock"}}

Root cause in the shipped package

  1. dist/cli/index.js, dist/daemon/main.js, and dist/mcp/main.js construct a filesystem endpoint with join(dataDirectory, "daemon.sock"). dist/ports/ipc.js passes this directly to node:net's connect(endpoint) and server.listen(endpoint). On Windows these APIs require a named pipe, for example \\.\pipe\simlock-daemon, as documented in Node's IPC documentation.

  2. sdkPathsAt and firstCompleteToolBin in dist/drivers/android/index.js check for emulator/emulator, platform-tools/adb, avdmanager, and sdkmanager, without the Windows .exe / .bat suffixes.

  3. The shipped NodeProcessRunner uses native child_process.spawn for all commands. Once discovery returns .bat paths, Windows batch-file execution also needs handling.

Local workaround and verification

A local compatibility patch was applied to the installed package:

  • At the NodeIpcTransport boundary, map filesystem endpoints on Windows to a deterministic \\.\pipe\simlock-<sha256> name derived from the normalized absolute endpoint path. Preserve existing pipe endpoints, keep separate data directories isolated, and leave non-Windows endpoints unchanged.
  • Recognize .exe and .bat SDK filenames on Windows.
  • Route Windows .bat / .cmd processes through the already-installed [email protected] adapter; retain native spawning for other commands.
  • Set windowsHide: true for background child processes.

With that local patch:

simlock daemon stop --json       -> {"status":"stopping"}
simlock daemon status --json     -> {"status":"stopped"}
simlock daemon start --json      -> {"status":"running"}
simlock doctor --fix             -> {"findings":[]}
simlock doctor                  -> {"findings":[]}

The Android catalog command then succeeded and reported the installed API 36 runtime and device profiles. The daemon log changed from "Skipped Android driver" to "Discovered driver" for Android, and only one daemon process remained after restart.

Emulator provisioning, boot, and lease lifecycle were not tested. The changes above are a local workaround, not a submitted upstream fix.

Activity

  1. leonardoxr commented on Oct 30, 2026

    @leonardoxr
    Contributor

    Thanks for the detailed report. Your root-cause analysis matched what we found. There are two PRs, which together fix this:

    With both, on Windows 11 with Node 24, doctor is clean. An Android lease boots in about a minute on the host GPU and reclaims from its snapshot, and nuke and daemon stop leave nothing running. The details are in the PRs.

    🤖 Generated with Claude Code

  2. added this to the Windows support milestone on Oct 30, 2026
  3. added
    os:windows
    platform:android
    on Oct 30, 2026
  4. added
    bug:new
    on Nov 18, 2026
  5. self-assigned this
    on Nov 18, 2026
  6. V3RON commented on Nov 18, 2026

    @V3RON
    Contributor

    Not reproducible on main (6729e67). #1052 and #1053 fixed every claim in this report. Both shipped in v0.4.1, and the current release is v0.8.0.

    Claim (0.2.0) On main Pinned by
    Endpoint is a socket file on Windows resolveDaemonSocketPath returns \\.\pipe\simlock-<hash> on win32 (src/ports/paths.ts:75). The CLI, daemon, MCP server and updater all call it src/ports/paths.test.ts
    SDK discovery wants Unix names .exe/.bat on win32, plus %LOCALAPPDATA%\Android\Sdk (src/drivers/android/sdk-paths.ts:96-134) src/drivers/android/prerequisites.test.ts
    .bat tools spawn natively they run through cmd.exe /d /s /c (src/ports/windows-command.ts) src/ports/windows-command.test.ts
    Failed daemons stay running a start that fails calls process.exit() (src/daemon/main.ts:850) —
    pnpm exec vitest run --project unit src/ports/paths.test.ts src/drivers/android/prerequisites.test.ts src/ports/windows-command.test.ts
    Test Files  3 passed (3)
         Tests  66 passed | 5 skipped (71)   # the skipped ones spawn real processes on win32 only
    

    To reproduce, I need the same commands (doctor, doctor --fix, daemon start, daemon stop) run on native Windows with [email protected], and their output and daemon.log if any of them still fails. If they all pass, this can be closed.

    Written by an agent.

  7. added
    bug:needs-info
    and removed
    bug:new
    on Nov 18, 2026
  8. removed their assignment
    on Nov 18, 2026
  9. V3RON commented on Nov 18, 2026

    @V3RON
    Contributor

    Delivery run

    Merged: none
    Parked: none
    Waiting: #1051 — on the reporter (cannot reproduce on main; fixed by #1052 and #1053, moved to bug:needs-info)

    Written by an agent.

  10. randroid88 commented on Nov 18, 2026

    @randroid88
    Author

    Retested on the original reporter's native Windows machine with the published, unmodified [email protected]. The startup timeout and Android SDK discovery failures reported here no longer reproduce.

    Environment: Windows 11 x64 (10.0.26200), Windows PowerShell 5.1.26100.9818, Node v24.18.0, npm 12.0.2.

    I installed 0.8.0 into a fresh local npm prefix and used an empty, separate SIMLOCK_HOME. Commands invoked that installation's dist/cli/main.js with native Windows Node; both the CLI and running daemon reported 0.8.0. The old global 0.2.0 compatibility patch was not used or changed.

    Results (all exit 0):

    simlock --version                     -> 0.8.0
    simlock daemon status --json           -> {"status":"stopped"}
    simlock doctor                        -> {"findings":[],"sources":[]}
    simlock doctor --fix                  -> {"findings":[],"sources":[]}
    simlock daemon start --json            -> {"status":"running"}
    simlock catalog --platform android --json
                                          -> 95 models; runtimes ["28","36"];
                                             defaultRuntime "36"
    simlock daemon stop --json             -> {"status":"stopping"}
    simlock daemon status --json           -> {"status":"stopped"}
    

    An explicit start after stopping, a repeated start while running, another doctor, and a final stop/status also passed. After shutdown, the Windows process inventory contained zero daemon processes from the tested installation.

    The daemon log confirms the Android driver was loaded and IPC used a Windows named pipe:

    {"module":"daemon.driver-discovery","message":"Discovered driver","fields":{"platform":"android"}}
    {"module":"daemon.connection-host","message":"Claimed daemon socket","fields":{"endpoint":"\\\\.\\pipe\\simlock-db2c7d82bc909d30"}}
    {"module":"daemon.connection-host","message":"Released daemon socket","fields":{"endpoint":"\\\\.\\pipe\\simlock-db2c7d82bc909d30"}}

    Additional checks against the shipped modules:

    • SDK discovery also succeeds with ANDROID_HOME and ANDROID_SDK_ROOT omitted, and with LOCALAPPDATA additionally omitted.
    • The shipped NodeProcessRunner successfully runs the real sdkmanager.bat --version (22.0) and avdmanager.bat list device (includes Pixel 9), both exit 0. SDK stderr includes a sdkmanager deprecation notice and missing devices.xml messages for installed system images; catalog enumeration still succeeds.

    There were no daemon error-level entries. Two warning-level messages remain in the 0.8.0 log, matching the separately tracked #1664 (npm shell wrapper executed with Node during the version check) and #1665 (Windows mode 666 / chmod 700 warning). Neither blocked the commands above.

    This verifies the original startup/discovery problem. Emulator provisioning, boot, snapshot reuse, lease lifecycle, and deliberately injected startup failures were not tested in this pass.

    Verified and posted by an agent on the reporter's Windows machine.

  11. added
    bug:new
    and removed
    bug:needs-info
    on Nov 18, 2026
  12. self-assigned this
    on Nov 18, 2026
  13. V3RON commented on Nov 18, 2026

    @V3RON
    Contributor

    Not reproducible on main (6729e67), and the retest above confirms it on the published [email protected]: doctor, doctor --fix, daemon start and daemon stop all exit 0, the daemon listens on \\.\pipe\simlock-<hash>, the Android driver is discovered, and no daemon process is left after stop. #1052 and #1053 fixed it, as the earlier triage said.

    I ran the unit tests that pin those fixes again on main:

    pnpm exec vitest run --project unit src/ports/paths.test.ts src/drivers/android/prerequisites.test.ts src/ports/windows-command.test.ts
    Test Files  3 passed (3)
         Tests  66 passed | 5 skipped (71)
    

    The two warnings left in the 0.8.0 log are #1664 and #1665, both closed.

    No test fails, so there is nothing to reproduce and no repro branch. Nothing more is needed from the reporter. This can be closed as completed. Two weeks in bug:needs-info would close it as not planned.

    Written by an agent.

  14. added
    bug:needs-info
    and removed
    bug:new
    on Nov 18, 2026
  15. removed their assignment
    on Nov 18, 2026
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

    bug:needs-infoos:windowsplatform:android

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions