facebook/flow · critical
Daemon child: failed to write token to parent in-socket: {}
Error message
Daemon child: failed to write token to parent in-socket: {} What it means
Final handshake step: the child writes the authentication token to the parent's in-socket (its write channel). write_all failing means that socket broke before or during the write: the parent closed its read end (gave up waiting, crashed) yielding EPIPE, or the loopback connection was reset mid-write.
Source
Thrown at rust_port/crates/flow_daemon/src/daemon.rs:566
panic!(
"Daemon child: failed to write token to parent out-socket: {}",
e
)
});
let mut child_out_sock = TcpStream::connect(parent_in_addr).unwrap_or_else(|e| {
panic!(
"Daemon child: failed to connect to parent in-socket (child write end): {}",
e
)
});
child_out_sock.set_nodelay(true).unwrap_or_else(|e| {
panic!(
"Daemon child: failed to set TCP_NODELAY on parent in-socket: {}",
e
)
});
child_out_sock.write_all(&token).unwrap_or_else(|e| {
panic!(
"Daemon child: failed to write token to parent in-socket: {}",
e
)
});
exec(&entry_name, child_in_sock, child_out_sock, param_bytes);
}
pub fn close<I, O>(h: &mut Handle<I, O>) -> std::io::Result<()> {
h.channels.0.stream.shutdown(std::net::Shutdown::Read)?;
h.channels.1.stream.shutdown(std::net::Shutdown::Write)?;
Ok(())
}
pub fn close_noerr<I, O>(h: &mut Handle<I, O>) {
if let Err(e) = h.channels.0.stream.shutdown(std::net::Shutdown::Read) {
tracing::debug!(target: "flow_daemon", "close_noerr (in): {}", e);
}View on GitHub (pinned to f88ac94bcf)
Solutions
- Retry the command; one-off handshake races typically clear
- Address load/memory pressure so the parent survives the full handshake
- flow stop, then retry to start from clean daemon state
- Inspect parent logs for early exit reasons if it repeats
Defensive patterns
Strategy: retry
Prevention
- Retry the command; broken handshake pipes are usually one-off races
- Address memory/load pressure so the parent survives the full two-socket handshake
- Run flow stop before retrying to start from clean daemon state
When it happens
Trigger: Parent times out or exits after accepting but before reading the second token write; connection reset by the OS; process tree torn down by a supervisor during the handshake.
Common situations: Heavily loaded or throttled machines stretching the two-write handshake past parent timeouts; OOM killing the parent mid-handshake; cleanup scripts killing daemon trees during spawn.
Related errors
- Daemon child: failed to write token to parent out-socket: {}
- Daemon child: failed to connect to parent out-socket (child
- Daemon child: failed to set TCP_NODELAY on parent out-socket
- Daemon child: failed to connect to parent in-socket (child w
- Daemon child: failed to set TCP_NODELAY on parent in-socket:
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/3f7cc8b9cc633c66.
Report an issue: GitHub.