Nx "Daemon process terminated" - Fix Daemon Crashes in CI
The Nx daemon - a background process that caches the project graph - crashed or was killed mid-run, so the connection dropped. On a constrained runner this is usually memory pressure or a stale daemon socket, and it often clears on retry or with the daemon disabled.
What this error means
A command fails with "NX Daemon process terminated and closed the connection". It is intermittent - re-running the job, or disabling the daemon, frequently succeeds with no code change, which points at a transient/resource issue rather than a config bug.
NX Daemon process terminated and closed the connection
Please rerun the command, which will restart the daemon.
If you get this error again, check for memory limits and stale lock files.Common causes
Daemon killed under memory pressure
On a small runner the daemon process can be OOM-killed while building a large project graph, dropping the connection mid-command.
Stale daemon socket or lock
A leftover socket/lock from a previous run (or a cached .nx/ directory restored between jobs) can leave the daemon in a bad state.
How to fix it
Reset and retry
Clearing the daemon state and rerunning resolves most transient crashes.
nx reset
nx run-many -t buildDisable the daemon in CI
CI runs are short-lived, so the daemon’s caching benefit is small. Disabling it removes a whole class of flake.
export NX_DAEMON=false
nx affected -t buildGive the runner more memory
- If the daemon is being OOM-killed, move the job to a larger runner.
- Avoid caching
.nx/across jobs if a stale graph is implicated. - On a self-healing runner, daemon OOM/termination can be retried automatically on a larger instance.
How to prevent it
- Set
NX_DAEMON=falsein CI to avoid daemon lifecycle flake. - Size runners to fit the project-graph memory footprint of large workspaces.
- Do not persist
.nx/daemon state across unrelated jobs.