facebook/flow · error

Unable to determine executable path: {}

Error message

Unable to determine executable path: {}

What it means

executable_path() caches std::env::current_exe() in a process-wide OnceLock and panics on failure. current_exe resolves the running binary's path (/proc/self/exe on Linux); it fails when the executable file was deleted or replaced after the process started, when /proc is not mounted or masked, or on platforms where the lookup is unsupported.

Source

Thrown at rust_port/crates/flow_common/src/sys_utils.rs:83

/// http://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html
///
/// ~/foo -> /home/bob/foo if $HOME = "/home/bob"
/// ~joe/foo -> /home/joe/foo if joe's home is /home/joe
pub fn expanduser(path: &str) -> String {
    if let Some(rest) = path.strip_prefix("~/") {
        if let Ok(home) = env::var("HOME") {
            return format!("{}/{}", home, rest);
        }
    }
    path.to_string()
}

pub fn executable_path() -> &'static Path {
    static CACHED: OnceLock<PathBuf> = OnceLock::new();
    CACHED
        .get_or_init(|| {
            env::current_exe()
                .unwrap_or_else(|e| panic!("Unable to determine executable path: {}", e))
        })
        .as_path()
}

pub fn mkdir_no_fail(dir: &Path) -> io::Result<()> {
    with_umask(0, || match std::fs::DirBuilder::new().create(dir) {
        Ok(()) => Ok(()),
        Err(e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
        Err(e) => Err(e),
    })
}

pub fn is_rosetta() -> bool {
    static CACHED: OnceLock<bool> = OnceLock::new();
    *CACHED.get_or_init(|| {
        #[cfg(target_os = "macos")]
        {
            match std::process::Command::new("sysctl")

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Restart the flow process/daemon (flow stop, then rerun) so it starts from the current binary
  2. Reinstall the flow package to restore a missing executable file
  3. In containers, ensure /proc is mounted and not masked
  4. Avoid deleting or replacing a binary while processes started from it are alive

Example fix

# before
npm upgrade flow-bin   # while a flow daemon from the old binary is still running
flow check             # panics: Unable to determine executable path: ...

# after
flow stop
npm upgrade flow-bin
flow check
Defensive patterns

Strategy: retry

Validate before calling

# sanity: /proc mounted and self resolvable on Linux
ls -l /proc/self/exe || echo "procfs unavailable: fix container mounts"

Prevention

When it happens

Trigger: The flow binary (or a running daemon started from it) is deleted/overwritten by an upgrade while still running; /proc not mounted in a minimal container; exotic execution environments (some chroots, execve-from-memfd) where the path cannot be recovered.

Common situations: npm/yarn/apt upgrading flow underneath a long-lived flow server started from the old inode; hardened containers masking /proc; CI caching that swaps binaries mid-job.

Related errors


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