facebook/flow · error

failed to create {}: {}

Error message

failed to create {}: {}

What it means

During flow init, after building the config, the CLI creates the .flowconfig file with std::fs::File::create. Failure panics with the target path and the OS error. Typical errno causes: EACCES (directory not writable), EISDIR/EEXIST variant where .flowconfig is a directory, EROFS (read-only mount), or ENAMETOOLONG.

Source

Thrown at rust_port/crates/flow_cli/src/init_command.rs:143

        untyped,
        declarations,
        includes,
        libs,
        options,
        lints,
    );
    let config = match config {
        Ok((config, warnings)) if warnings.is_empty() => config,
        Ok((_config, warnings)) => error(
            warnings
                .into_iter()
                .map(|flow_config::Warning(line, msg)| (line, msg))
                .collect(),
        ),
        Err(flow_config::Error(line, msg)) => error(vec![(line, msg)]),
    };
    let mut out = std::fs::File::create(&file)
        .unwrap_or_else(|err| panic!("failed to create {}: {}", file.display(), err));
    flow_config::write(&mut out, &config)
        .unwrap_or_else(|err| panic!("failed to write {}: {}", file.display(), err));
}

pub(crate) fn command() -> command_spec::Command {
    command_spec::command(spec(), main)
}

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. cd into a writable project directory and rerun flow init
  2. If .flowconfig exists as a directory, remove it (rmdir .flowconfig) or rename it, then rerun
  3. chmod u+w . on the target directory or fix ownership
  4. Check for a read-only mount (mount | grep <dir>) and remount rw or pick another location

Example fix

# before
cd /opt/shared-read-only && flow init   # panics: failed to create /opt/shared-read-only/.flowconfig: Permission denied

# after
mkdir -p ~/proj && cd ~/proj && flow init
Defensive patterns

Strategy: validation

Validate before calling

# before running flow init
test -w "$(pwd)" || echo "not writable: fix permissions/mount"
[ ! -e .flowconfig ] || echo ".flowconfig already exists (and must not be a directory)"

Prevention

When it happens

Trigger: Running flow init in a directory the user cannot write to; a directory named .flowconfig already existing at the target; running on a read-only filesystem or container layer; path length limits exceeded.

Common situations: Running flow init in system directories or a mounted repo owned by another user; Docker/CI sandboxes with read-only workspaces; leftover .flowconfig directory from a mis-scripted setup.

Related errors


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