facebook/flow · error

mkdir_no_fail({:?}): {}

Error message

mkdir_no_fail({:?}): {}

What it means

This panic fires inside flow_flowlib when extract() prepares the directory that will hold the extracted built-in libraries (Prelude, Flowlib, or Tslib, usually under the Flow temp dir). mkdir() first creates the PARENT of the libdir via sys_utils::mkdir_no_fail, and any failure is fatal: the process aborts with the offending parent directory in the message. extract() cannot proceed without this directory, so there is no fallback path.

Source

Thrown at rust_port/crates/flow_flowlib/src/lib.rs:98

        BuiltinLib::Flowlib => LibDir::Flowlib(path),
        BuiltinLib::Prelude => LibDir::Prelude(path),
        BuiltinLib::Tslib => LibDir::Tslib(path),
    }
}

pub fn path_of_libdir(libdir: &LibDir) -> &Path {
    match libdir {
        LibDir::Prelude(path) => path,
        LibDir::Flowlib(path) => path,
        LibDir::Tslib(path) => path,
    }
}

fn mkdir(libdir: &LibDir) {
    let path = path_of_libdir(libdir);
    let parent_dir = path.parent().expect("libdir path should have a parent");
    sys_utils::mkdir_no_fail(parent_dir)
        .unwrap_or_else(|e| panic!("mkdir_no_fail({:?}): {}", parent_dir, e));
    sys_utils::mkdir_no_fail(path).unwrap_or_else(|e| panic!("mkdir_no_fail({:?}): {}", path, e));
}

fn write_flowlib(dir: &Path, (filename, contents): &(&str, &str)) {
    let file = dir.join(filename);
    fs::write(&file, contents).expect("failed to write flowlib file");
}

pub fn extract(libdir: &LibDir) {
    mkdir(libdir);
    let (path, lib) = match libdir {
        LibDir::Prelude(path) => (path.as_path(), BuiltinLib::Prelude),
        LibDir::Flowlib(path) => (path.as_path(), BuiltinLib::Flowlib),
        LibDir::Tslib(path) => (path.as_path(), BuiltinLib::Tslib),
    };
    for entry in contents(lib) {
        write_flowlib(path, entry);
    }

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Inspect the directory printed in the panic message: stat each component of the path to find the one that is a file or has bad mode bits.
  2. Fix it: chmod/chown the temp dir to the daemon user, or delete the stale file blocking the mkdir, then retry startup.
  3. Point the temp dir somewhere writable (TMPDIR env or the temp_dir option in .flowconfig) and restart the server.
  4. If the filesystem is read-only (container image), mount a writable tmpfs or choose a different temp_dir.
  5. If the disk is full, free space and retry.

Example fix

# before: temp_dir points into a read-only location
[options]
temp_dir=/usr/share/flow-tmp

# after: use a writable temp dir
[options]
temp_dir=/tmp/flow
Defensive patterns

Strategy: validation

Validate before calling

use std::{fs, io, path::Path};

fn ensure_dir_writable(p: &Path) -> io::Result<()> {
    fs::create_dir_all(p)?;
    let probe = p.join(".write-probe");
    fs::write(&probe, b"")?;
    fs::remove_file(&probe)
}

// before calling flow_flowlib::extract(&libdir)
ensure_dir_writable(flow_flowlib::path_of_libdir(&libdir).parent().unwrap())?;

Try / catch

let outcome = std::panic::catch_unwind(|| flow_flowlib::extract(&libdir));
if outcome.is_err() {
    // extraction aborted (mkdir failure); surface a normal error to the
    // caller and point the user at temp-dir permissions instead of crashing
    return Err("flowlib extraction failed; check temp-dir permissions".into());
}

Prevention

When it happens

Trigger: Calling flow_flowlib::extract(&LibDir::Prelude/Flowlib/Tslib(..)) (which server and CLI startup do) when the libdir's parent, e.g. <temp_dir>/flow/<hash>/, cannot be created: a path component has wrong permissions, a regular file exists where a directory is expected, the filesystem is read-only, or the temp dir was deleted concurrently.

Common situations: Containers or sandboxes where TMPDIR is read-only; running the daemon as a user that does not own the temp dir; leftover files left behind by a crashed earlier run at exactly the parent path; disk full; macOS seals or noexec mounts on the temp location.

Related errors


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