{"record":{"id":"4e760193d84a732c","repo":"biomejs/biome","slug":"connectionreset","errorCode":"ConnectionReset","errorMessage":"the server process exited before the connection could be established","messagePattern":"the server process exited before the connection could be established","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/biome_cli/src/service/unix.rs","lineNumber":233,"sourceCode":"                return Ok(current_child.is_some());\n            }\n\n            // There's no process listening on the global socket\n            Err(err)\n                if matches!(\n                    err.kind(),\n                    ErrorKind::NotFound | ErrorKind::ConnectionRefused\n                ) =>\n            {\n                last_error = Some(err);\n\n                if let Some(current_child) = &mut current_child {\n                    // If we have a handle to the daemon process, wait for a few\n                    // milliseconds for it to exit, or retry the connection\n                    tokio::select! {\n                        result = current_child.wait() => {\n                            let _status = result?;\n                            return Err(io::Error::new(\n                                io::ErrorKind::ConnectionReset,\n                                \"the server process exited before the connection could be established\",\n                            ));\n                        }\n                        _ = time::sleep(Duration::from_millis(50)) => {}\n                    }\n                } else {\n                    // Spawn the daemon process and wait a few milliseconds for\n                    // it to become ready then retry the connection\n                    current_child = Some(spawn_daemon(\n                        stop_on_disconnect,\n                        watcher_configuration.clone(),\n                        log_options.clone(),\n                    )?);\n                    time::sleep(Duration::from_millis(50)).await;\n                }\n            }\n","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/biomejs/biome/blob/45a19bbf1747401274f1be1f9f89d6af91367190/crates/biome_cli/src/service/unix.rs#L215-L251","documentation":"Unix daemon bootstrap failure (crates/biome_cli/src/service/unix.rs:226-235). ensure_daemon retries the socket connection up to 10 times; after spawning the daemon child it waits 50ms via tokio::select - if the child process exits within that window, the CLI returns io::ErrorKind::ConnectionReset with this message. In short: the Biome daemon process was spawned but died before it could listen on its socket (path from get_socket_name(): the biome cache dir plus 'biome-socket-{VERSION}', unix.rs:26-28).","triggerScenarios":"Any Biome CLI command needing the daemon (biome start, LSP socket usage, biome __listen_socket) when the freshly spawned daemon process crashes at startup: stale socket file owned by another user, non-writable cache dir (XDG_CACHE_HOME / TMPDIR), incompatible or corrupted binary, or the child exiting due to a startup error.","commonSituations":"Containers/CI sandboxes with read-only HOME or cache dirs; two Biome versions sharing the machine where the stale socket for this VERSION belongs to a dead process; upgrading Biome while an old daemon lingers; permission mismatch when switching users; disk-full or noexec mount preventing the child from running.","solutions":["Run biome stop (or biome daemon stop) to clean up, then retry; if unavailable, remove the stale socket manually: rm -f \"${XDG_CACHE_HOME:-$HOME/.cache}/biome\"/biome-socket-*","Ensure the cache dir is writable by the current user: mkdir -p \"${XDG_CACHE_HOME:-$HOME/.cache}/biome\" and check permissions","Start the daemon in the foreground (biome start --verbose, or run the daemon binary directly) to see why the child exits - look for startup panics, socket bind errors, or config parse errors","Verify the binary: correct architecture, not corrupted mid-download, and CLI/daemon from the same Biome version; re-download if suspect","If an environment variable like TMPDIR/XDG_CACHE_HOME points somewhere unusual, set it to a writable directory and retry"],"exampleFix":"# before\nbiome format src/  # error: the server process exited before the connection could be established\n\n# after\nbiome stop 2>/dev/null || rm -f \"${XDG_CACHE_HOME:-$HOME/.cache}/biome\"/biome-socket-*\nbiome start --verbose  # observe daemon startup, then retry the command","handlingStrategy":"retry","validationCode":"# shell - clean stale sockets and verify writability before invoking Biome\nCACHE_DIR=\"${XDG_CACHE_HOME:-$HOME/.cache}/biome\"\nmkdir -p \"$CACHE_DIR\" || { echo \"cannot create cache dir\" >&2; exit 1; }\n[ -w \"$CACHE_DIR\" ] || { echo \"cache dir not writable\" >&2; exit 1; }\nrm -f \"$CACHE_DIR\"/biome-socket-* 2>/dev/null\nbiome start","typeGuard":null,"tryCatchPattern":"# shell - retry once after cleanup, then surface the daemon's own error\nbiome format src/ || {\n  biome stop 2>/dev/null || rm -f \"${XDG_CACHE_HOME:-$HOME/.cache}/biome\"/biome-socket-*\n  biome start --verbose || exit 1   # show why the daemon dies at startup\n  biome format src/\n}","preventionTips":["Run biome stop when uninstalling or switching Biome versions so no stale socket remains","In containers/CI, set XDG_CACHE_HOME (or HOME) to a writable directory before invoking Biome","Keep CLI and daemon binaries from the same installed version; avoid invoking a daemon from a different checkout","After an upgrade, run biome start once explicitly and check it stays up before scripting long sessions"],"tags":["unix","daemon","socket","connection","startup-crash"],"backgroundTag":"daemon-startup-crash","analyzedSha":"45a19bbf1747401274f1be1f9f89d6af91367190","analyzedAt":"2026-08-20T00:25:09.682Z","contentChangedAt":"2026-08-20T00:25:09.682Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}