facebook/relay · error
Failed to spawn daemon process
Error message
Failed to spawn daemon process
What it means
Startup panic in start_daemon_process: Command::spawn failed when trying to launch the compiler server as a background child process (current exe re-invoked with the 'server ... start --foreground' argument vector). Spawn failures are environmental — executable permissions, fd limits, or resource exhaustion — not compilation errors.
Source
Thrown at compiler/crates/relay-compiler/src/server_daemon.rs:397
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")
{
error!("Daemon process exited during startup with {status}");
log_daemon_file(&log_path);
std::process::exit(1);
}
if send_request(&socket_path, DaemonRequest::Version)
.awaitView on GitHub (pinned to 668b1b85e0)
Solutions
- Verify the current executable is still present and executable (it may have been replaced mid-run by a rebuild)
- Raise process/fd limits if the system refuses to fork or allocate stdio pipes
- Check overall system memory and process counts; retry after freeing resources
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at compiler/crates/relay-compiler/src/server_daemon.rs:397 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/9969b7ef5e78d04c.
Report an issue: GitHub.