facebook/flow · error

fd_of_path: mkdir_no_fail({:?}): {}

Error message

fd_of_path: mkdir_no_fail({:?}): {}

What it means

fd_of_path prepares daemon redirect targets: with umask 0o111 it first creates the path's parent directories via mkdir_no_fail, which tolerates AlreadyExists and forwards other errors; this panic reports that mkdir failure. Causes: EACCES/EROFS on the temp root, ENOTDIR when a file occupies a component, ENOSPC, or quota exhaustion.

Source

Thrown at rust_port/crates/flow_daemon/src/daemon.rs:350

{
    entry::register(name, f)
}

pub fn name_of_entry<P, I, O>(entry: &Entry<P, I, O>) -> &'static str {
    entry::name_of_entry(entry)
}

// `Daemon.fd_of_path` in OCaml returns a `Unix.file_descr`. We return a
// `std::fs::File` instead: it is the cross-platform Rust analogue (works on
// both Unix and Windows), is convertible to `Stdio` via `Stdio::from(File)`
// on every platform, and avoids the Unix-only `OwnedFd`.
pub fn fd_of_path(path: &Path) -> File {
    sys_utils::with_umask(0o111, || {
        if let Some(parent) = path.parent()
            && !parent.as_os_str().is_empty()
        {
            sys_utils::mkdir_no_fail(parent)
                .unwrap_or_else(|e| panic!("fd_of_path: mkdir_no_fail({:?}): {}", parent, e));
        }
        std::fs::OpenOptions::new()
            .read(true)
            .write(true)
            .create(true)
            .truncate(true)
            .open(path)
            .unwrap_or_else(|e| panic!("fd_of_path: open({:?}): {}", path, e))
    })
}

pub fn null_fd() -> File {
    fd_of_path(Path::new(sys_utils::null_path()))
}

// `StdioFd` lets callers either inherit one of the parent's standard streams
// (matching OCaml's `if stdin <> Unix.stdin then close_if_open stdin` at lines
// 207-213, where passing `Unix.stdin` means "inherit") or pass an owned file

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Set TMPDIR to a clean, writable, local directory and retry
  2. Remove files occupying the parent path reported in the panic
  3. Fix permissions or remount read-write the volume holding the temp dir
  4. Free space / raise quota if ENOSPC/EDQUOT

Example fix

# before
TMPDIR=/readonly-vol/tmp flow start   # panics: fd_of_path: mkdir_no_fail(...)

# after
mkdir -p /local/tmp
TMPDIR=/local/tmp flow start
Defensive patterns

Strategy: validation

Validate before calling

# before starting the daemon
test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR" || echo "TMPDIR invalid/unwritable"
df -h "${TMPDIR:-/tmp}" | tail -1   # watch for a full volume

Prevention

When it happens

Trigger: Creating the parent tree for a daemon stdio/log path under TMPDIR when TMPDIR is unwritable, read-only, full, or contains a file where a directory component is needed.

Common situations: Hardened CI containers with restrictive /tmp; TMPDIR pointed at a read-only volume; leftover regular files from earlier crashed runs blocking the directory tree; disk quota hit on shared hosts.

Related errors


AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20). Data as JSON: /api/errors/582fc469d15cd7ab. Report an issue: GitHub.