facebook/relay · error

Failed to clone daemon log file handle

Error message

Failed to clone daemon log file handle

What it means

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.

Source

Thrown at compiler/crates/relay-compiler/src/server_daemon.rs:389

    let mut args = vec!["server".to_string()];
    args.extend(extra_args.iter().cloned());
    for project in projects {
        args.push("--project".to_string());
        args.push(project.clone());
    }
    args.push("start".to_string());
    args.push("--foreground".to_string());
    args.extend(start_extra_args.iter().cloned());

    let log_path = get_log_file_path(config_path, projects);
    let log_file = File::options()
        .create(true)
        .append(true)
        .open(&log_path)
        .expect("Failed to open daemon log file");
    let log_file_clone = log_file
        .try_clone()
        .expect("Failed to clone daemon log file handle");

    let mut child = Command::new(current_exe)
        .args(&args)
        .stdin(Stdio::null())
        .stdout(Stdio::from(log_file))
        .stderr(Stdio::from(log_file_clone))
        .spawn()
        .expect("Failed to spawn daemon process");

    let socket_path = get_socket_path(config_path, projects);
    let max_attempts = 60;
    for i in 0..max_attempts {
        tokio::time::sleep(std::time::Duration::from_secs(1)).await;

        // Detect early daemon-process exit (e.g. invalid project name).
        if let Some(status) = child
            .try_wait()
            .expect("Failed to check daemon process status")

View on GitHub (pinned to 668b1b85e0)

Solutions

  1. Check process file-descriptor limits (ulimit -n) and raise them if exhausted
  2. Ensure the log file is on a healthy filesystem that supports dup-like operations on open handles
  3. Close other leaking file handles in the invoking process before starting the daemon
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at compiler/crates/relay-compiler/src/server_daemon.rs:389 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02). Data as JSON: /api/errors/f6371e12f833be03. Report an issue: GitHub.