agent-device daemon never becomes reachable on Windows 11 (Failed to start daemon)
On native Windows 11 (not WSL), agent-device 0.21.23 run via
npx agent-devicefails every command withCOMMAND_FAILED: Failed to start daemon;npx agent-device doctor --debugshowsDaemon error: EPERM: operation not permitted, ftruncatein~/.agent-device/daemon.log. After working around that, the daemon listens but the client still reports it asnot-running. Why does this happen and what version or fix actually works on Windows?Originally asked on GitHub: https://github.com/callstack/agent-device/issues/3291
5 answers
Fixed on
mainby PR #3330 (commit87c5b3ba3), but not in any npm release yet: 0.21.21–0.21.23 still have the bug, and 0.21.20 is the last released version that works on native Windows. Pinnpm i -D agent-device@0.21.20until the next release.The thread identifies two separate Windows-host bugs:
-
Log truncation fails with
EPERM.src/daemon-registration-owner.tsopensdaemon.logwith flag'a'and then callsfs.ftruncateSyncon that append-only handle, which Windows disallows, so the daemon exits withDaemon error: EPERM: operation not permitted, ftruncate. The reporter's manual workaround was to open the file with'a'and truncate through a separate handle opened with'r+'; the merged fix truncates through a handle that permitsftruncateon Windows. -
Process identity is Unix-only.
owner-identity.jschecks ownership withps -ax -o pid=,ppid=,command=andlstart, which do not exist on Windows, so even a listening daemon is reported asnot-running(Daemon registration busy; exiting.). The merged fix moves identity (birth time, command line, liveness) to a single PowerShell CIMWin32_Processquery inhost-process.ts, with POSIX behavior kept byte-identical.
The reporter notes Windows host support is not documented, so this is not a regression. Repro:
npm i -D agent-device@0.21.23thennpx agent-device doctor --debugon Windows 11 Pro, Node 26.7.0.Did this work for you?-
What @IGx89 tried on GitHub (Worked)
A commenter reports that 0.21.20 works well on Windows while 0.21.21–0.21.23 do not, confirming the regression window and the working release.
Source: https://github.com/callstack/agent-device/issues/3291#issuecomment-6086770484 (opens external site)
Did this work for you?What @thymikee tried on GitHub (Worked)
An external tester ran the full checklist at PR #3330 head
a7821ef58on native Windows 11 (Node 24.21.0 + Electron 44.4.2, both transports): clean start with zero EPERM,processStartTimeexactly matching the daemon pid's CIMCreationDate, daemon reuse, graceful stop, and a non-ASCII-path round-trip all passed.Source: https://github.com/callstack/agent-device/issues/3291#issuecomment-6086321329 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Partly worked)
Reporter's manual workaround: patched
truncateDaemonLogto open the log with'a'and truncate through a handle opened with'r+'. The daemon started and listened, but the client still reported it asnot-running.Source: https://github.com/callstack/agent-device/issues/3291 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reporter's original repro on native Windows 11:
npm i -D agent-device@0.21.23thennpx agent-device doctor --debug; every command failed withFailed to start daemonanddaemon.logshowed the EPERM ftruncate error.Source: https://github.com/callstack/agent-device/issues/3291 (opens external site)
Did this work for you?
Related questions
- agent-device open <package> fails on Android apps with multiple launcher activities
- agent-device web screenshot: how to capture the full page instead of the viewport?
- Why does agent-device take ~6.7s to resolve an Apple device, and can usbmuxd replace devicectl/xctrace?
- Why does agent-device iOS text-entry fail with TEXT_INPUT_COMMIT_NOT_OBSERVED intermittently on the simulator?
- agent-device daemon: client tenant trusted when auth hook doesn't attest tenantId?