facebook/flow · error
Realpath failed for existent path {}
Error message
Realpath failed for existent path {} What it means
Flow resolves realpaths by walking to the deepest existing prefix (find_real_prefix), canonicalizing that prefix, then re-attaching the non-existent suffix. The prefix is guaranteed to exist, so cached_canonicalize failing means the OS refused realpath on an existing path: symlink loop (ELOOP), permission denied traversing a symlinked component (EACCES), I/O error, or a race where the path vanished between the exists() check and canonicalize.
Source
Thrown at rust_port/crates/flow_common/src/files.rs:1432
rev_suffix.insert(0, basename);
let prefix = Path::new(path)
.parent()
.map(|p| p.to_string_lossy().into_owned())
.unwrap_or_else(|| ".".to_string());
// Sys.file_exists should always return true for / and for . so we should never get into
// infinite recursion. Let's assert that
assert!(prefix != path);
if Path::new(&prefix).exists() {
prefix
} else {
find_real_prefix(&prefix, rev_suffix)
}
}
let mut rev_suffix = Vec::new();
let real_prefix = find_real_prefix(path, &mut rev_suffix);
let abs = cached_canonicalize(Path::new(&real_prefix))
.unwrap_or_else(|_| panic!("Realpath failed for existent path {}", real_prefix));
let abs_str = abs.to_string_lossy().into_owned();
rev_suffix.iter().fold(abs_str, |acc, part| {
Path::new(&acc).join(part).to_string_lossy().into_owned()
})
}
pub fn module_file_exts(options: &FileOptions) -> Vec<&str> {
options
.module_file_exts
.iter()
.map(|s| s.as_str())
.collect()
}
pub fn node_resolver_dirnames(options: &FileOptions) -> &[String] {
&options.node_resolver_dirnames
}
View on GitHub (pinned to 5c86586199)
Solutions
- Reproduce with readlink -f <path from the panic> to see where resolution breaks
- Remove or fix looping/broken symlinks in the reported path (find -type l and inspect)
- Fix traversal permissions on symlink targets along the path
- Retry after stopping processes that were deleting/moving files, if it was a race
Example fix
# before ln -s b a; ln -s a b # cycle inside the repo flow check # panics: Realpath failed for existent path <prefix> # after rm a b flow check
Defensive patterns
Strategy: validation
Validate before calling
# before running flow over a tree with symlinks
find . -type l -exec readlink -f {} + 2>&1 | grep -i 'loop\|too many levels\|denied' && echo "fix these symlinks first" Prevention
- Avoid circular symlinks in repo tooling; validate with readlink -f during setup
- Ensure traversal permission on symlink targets and their parents
- Minimize concurrent delete/move churn while flow is resolving paths
When it happens
Trigger: A symlink cycle (a -> b -> a) inside the project or an ancestor; a symlink chain whose resolution needs permissions the user lacks; NFS/automount returning EIO; concurrent deletion making the prefix disappear mid-resolution.
Common situations: Monorepos with circular symlinks generated by tooling (pnpm-style links, yarn workspaces hacks); shared machines where a parent dir is traversable but a link target is not; editor/file-watcher activity deleting files while flow resolves paths.
Related errors
- failed to get current directory
- failed to read input file
- flow.js wasm is still loading; await flow.ready first.
- fd_of_path: mkdir_no_fail({:?}): {}
- fd_of_path: open({:?}): {}
AI-assisted analysis of facebook/flow@5c86586199 (2026-08-20).
Data as JSON: /api/errors/0e89df37baed8706.
Report an issue: GitHub.