{"record":{"id":"f6371e12f833be03","repo":"facebook/relay","slug":"failed-to-clone-daemon-log-file-handle","errorCode":null,"errorMessage":"Failed to clone daemon log file handle","messagePattern":"Failed to clone daemon log file handle","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-compiler/src/server_daemon.rs","lineNumber":389,"sourceCode":"    let mut args = vec![\"server\".to_string()];\n    args.extend(extra_args.iter().cloned());\n    for project in projects {\n        args.push(\"--project\".to_string());\n        args.push(project.clone());\n    }\n    args.push(\"start\".to_string());\n    args.push(\"--foreground\".to_string());\n    args.extend(start_extra_args.iter().cloned());\n\n    let log_path = get_log_file_path(config_path, projects);\n    let log_file = File::options()\n        .create(true)\n        .append(true)\n        .open(&log_path)\n        .expect(\"Failed to open daemon log file\");\n    let log_file_clone = log_file\n        .try_clone()\n        .expect(\"Failed to clone daemon log file handle\");\n\n    let mut child = Command::new(current_exe)\n        .args(&args)\n        .stdin(Stdio::null())\n        .stdout(Stdio::from(log_file))\n        .stderr(Stdio::from(log_file_clone))\n        .spawn()\n        .expect(\"Failed to spawn daemon process\");\n\n    let socket_path = get_socket_path(config_path, projects);\n    let max_attempts = 60;\n    for i in 0..max_attempts {\n        tokio::time::sleep(std::time::Duration::from_secs(1)).await;\n\n        // Detect early daemon-process exit (e.g. invalid project name).\n        if let Some(status) = child\n            .try_wait()\n            .expect(\"Failed to check daemon process status\")","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-compiler/src/server_daemon.rs#L371-L407","documentation":"Startup panic in start_daemon_process: duplicating the daemon log file handle via try_clone() failed. Two descriptors are needed — one each for the child's stdout and stderr redirection — so a failure here aborts daemon launch before the child process is spawned.","triggerScenarios":"Thrown at compiler/crates/relay-compiler/src/server_daemon.rs:389 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check process file-descriptor limits (ulimit -n) and raise them if exhausted","Ensure the log file is on a healthy filesystem that supports dup-like operations on open handles","Close other leaking file handles in the invoking process before starting the daemon"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}