{"record":{"id":"4726d82f4325c959","repo":"facebook/flow","slug":"can-t-decode-daemon-parameters","errorCode":null,"errorMessage":"Can't decode daemon parameters: {}","messagePattern":"Can't decode daemon parameters: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_daemon/src/daemon.rs","lineNumber":292,"sourceCode":"    // I'm not entirely sure what this does on Windows.\n    pub(crate) fn get_context() -> Option<(String, Context)> {\n        let entry = std::env::var(ENV_DAEMON).ok().filter(|s| !s.is_empty())?;\n        let file = std::env::var(ENV_DAEMON_PARAM)\n            .ok()\n            .filter(|s| !s.is_empty())?;\n        let bytes =\n            fs::read(&file).unwrap_or_else(|e| panic!(\"Can't find daemon parameters: {}\", e));\n        if let Err(e) = fs::remove_file(&file) {\n            tracing::warn!(\n                target: \"flow_daemon\",\n                \"Daemon::get_context: failed to remove param file {:?}: {}\",\n                file,\n                e\n            );\n        }\n        let (context, _): (Context, usize) =\n            bincode::serde::decode_from_slice(&bytes, bincode::config::legacy())\n                .unwrap_or_else(|e| panic!(\"Can't decode daemon parameters: {}\", e));\n        Some((entry, context))\n    }\n\n    // No-op in Rust: we never mutate the parent's env (we set per-child env\n    // via `Command::env`), so there's nothing to clear. Kept as a function\n    // for OCaml structural fidelity.\n    pub(crate) fn clear_context() {}\n}\n\npub use entry::Entry;\n\nfn exec(entry: &str, in_sock: TcpStream, out_sock: TcpStream, param_bytes: Vec<u8>) -> ! {\n    let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n        entry::find_and_call(entry, param_bytes, in_sock, out_sock);\n    }));\n    match result {\n        Ok(()) => std::process::exit(0),\n        Err(e) => {","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_daemon/src/daemon.rs#L274-L310","documentation":"When a flow daemon child starts, Daemon::get_context reads the parameter file the parent wrote and bincode-decodes a Context with the legacy config. The earlier arm already panicked if the file was missing; this panic means the file existed but its bytes failed to decode: a truncated/partially-flushed write, or a format/version mismatch between the flow build that wrote the file and the daemon binary decoding it.","triggerScenarios":"Two different flow versions interleaved (one install's client spawns a daemon from another install); the param file corrupted by a full disk during write; a leftover param file from an older daemon format being read by a newer build.","commonSituations":"Upgrading flow while daemons and socket/temp dirs persist; multiple flow installs on PATH; CI images reusing a polluted temp dir; disk-full events corrupting flow's temp files.","solutions":["Run flow stop (or kill leftover daemons) and retry so a fresh param file is written by the current build","Ensure exactly one flow version is reachable (one install on PATH, no stale copies)","Clear flow's temp/socket directory entries after upgrades","Free disk space if the volume was full when the file was written"],"exampleFix":"# before\nflow check   # daemon child panics: Can't decode daemon parameters: <e>\n\n# after\nflow stop\nrm -rf \"$TMPDIR\"/flow* 2>/dev/null\nflow check","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["flow stop after every flow upgrade so param files are rewritten by the current build","Keep one flow version on PATH per machine/CI image","Keep the temp volume off quota/full thresholds so param writes complete"],"tags":["daemon","serialization","version-mismatch","corruption"],"backgroundTag":"bincode-decode-failed","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}