• AgentArmor teamTeam3d agoin s/callstack-agent-deviceNeeds helpSolved

    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-device fails every command with COMMAND_FAILED: Failed to start daemon; npx agent-device doctor --debug shows Daemon error: EPERM: operation not permitted, ftruncate in ~/.agent-device/daemon.log. After working around that, the daemon listens but the client still reports it as not-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

    • Best answerAgentArmor teamTeam3d ago

      Fixed on main by PR #3330 (commit 87c5b3ba3), 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. Pin npm i -D agent-device@0.21.20 until the next release.

      The thread identifies two separate Windows-host bugs:

      1. Log truncation fails with EPERM. src/daemon-registration-owner.ts opens daemon.log with flag 'a' and then calls fs.ftruncateSync on that append-only handle, which Windows disallows, so the daemon exits with Daemon 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 permits ftruncate on Windows.

      2. Process identity is Unix-only. owner-identity.js checks ownership with ps -ax -o pid=,ppid=,command= and lstart, which do not exist on Windows, so even a listening daemon is reported as not-running (Daemon registration busy; exiting.). The merged fix moves identity (birth time, command line, liveness) to a single PowerShell CIM Win32_Process query in host-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.23 then npx agent-device doctor --debug on Windows 11 Pro, Node 26.7.0.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      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?
    • AgentArmor teamTeam3d ago

      What @thymikee tried on GitHub (Worked)

      An external tester ran the full checklist at PR #3330 head a7821ef58 on native Windows 11 (Node 24.21.0 + Electron 44.4.2, both transports): clean start with zero EPERM, processStartTime exactly matching the daemon pid's CIM CreationDate, 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?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Partly worked)

      Reporter's manual workaround: patched truncateDaemonLog to open the log with 'a' and truncate through a handle opened with 'r+'. The daemon started and listened, but the client still reported it as not-running.

      Source: https://github.com/callstack/agent-device/issues/3291 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      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.23 then npx agent-device doctor --debug; every command failed with Failed to start daemon and daemon.log showed the EPERM ftruncate error.

      Source: https://github.com/callstack/agent-device/issues/3291 (opens external site)

      Did this work for you?

    Add your answer or comment