{"record":{"id":"8bc72e840649e24b","repo":"facebook/flow","slug":"daemon-child-failed-to-write-token-to-parent-out","errorCode":null,"errorMessage":"Daemon child: failed to write token to parent out-socket: {}","messagePattern":"Daemon child: failed to write token to parent out-socket: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_daemon/src/daemon.rs","lineNumber":548,"sourceCode":"        parent_out_addr,\n        token,\n        param_bytes,\n    } = context;\n\n    let mut child_in_sock = TcpStream::connect(parent_out_addr).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to connect to parent out-socket (child read end): {}\",\n            e\n        )\n    });\n    child_in_sock.set_nodelay(true).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to set TCP_NODELAY on parent out-socket: {}\",\n            e\n        )\n    });\n    child_in_sock.write_all(&token).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to write token to parent out-socket: {}\",\n            e\n        )\n    });\n    let mut child_out_sock = TcpStream::connect(parent_in_addr).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to connect to parent in-socket (child write end): {}\",\n            e\n        )\n    });\n    child_out_sock.set_nodelay(true).unwrap_or_else(|e| {\n        panic!(\n            \"Daemon child: failed to set TCP_NODELAY on parent in-socket: {}\",\n            e\n        )\n    });\n    child_out_sock.write_all(&token).unwrap_or_else(|e| {\n        panic!(","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/daemon.rs#L530-L566","documentation":"As part of the daemon handshake, the child writes the shared token bytes to the parent's out-socket to authenticate itself. write_all failing here means the socket broke before/during the write: the parent closed its end (timeout, crash) yielding EPIPE/broken pipe, or the connection was reset mid-handshake.","triggerScenarios":"Parent flow process exits or times out waiting for the token before the child writes it; parent-side accept loop already gave up; connection reset by the OS or an intermediary on loopback.","commonSituations":"Slow/loaded machines stretching the handshake past the parent's timeout; process supervisors killing the parent tree mid-spawn; resource pressure causing the parent to abort startup.","solutions":["Retry the flow command; transient handshake races usually clear","Reduce load or increase resources if the machine is heavily loaded during startup","Run flow stop to clear stale daemon state before retrying","Check parent-side logs for the reason it closed the socket early"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reduce machine load during daemon startup so the handshake completes inside parent timeouts","Configure supervisors not to kill the flow parent mid-spawn","Retry the command once after flow stop if a handshake pipe breaks"],"tags":["daemon","socket","broken-pipe","handshake","spawn"],"backgroundTag":"broken-pipe","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}