can1357/oh-my-pi · error · StatError
cannot read file system information for {file}: {error}
Error message
cannot read file system information for {file}: {error} What it means
This error (crates/pi-builtins/src/stat.rs, CannotReadFilesystemInfo) indicates stat could not read filesystem information (mount point, filesystem type, block usage) for the given file while in file-system mode. The path exists context-wise but querying its filesystem metadata via the OS failed, and the underlying cause is embedded in `error`. Typically wraps an errno from the filesystem-id syscall.
Source
Thrown at crates/pi-builtins/src/stat.rs:148
NOTE: your shell may have its own version of stat, which usually supersedes
the version described here. Please refer to your shell's documentation
for details about the options it supports.";
#[derive(Debug, Error)]
enum StatError {
#[error("Invalid quoting style: {style}")]
InvalidQuotingStyle { style: String },
#[error("missing operand\nTry 'stat --help' for more information.")]
MissingOperand,
#[error("{directive}: invalid directive")]
InvalidDirective { directive: String },
#[error("cannot read table of mounted file systems: {error}")]
#[cfg_attr(not(unix), allow(dead_code, reason = "mount tables are unix-only"))]
CannotReadFilesystem { error: String },
#[error("using '-' to denote standard input does not work in file system mode")]
#[cfg_attr(not(unix), allow(dead_code, reason = "stdin filesystem mode is unix-only"))]
StdinFilesystemMode,
#[error("cannot read file system information for {file}: {error}")]
CannotReadFilesystemInfo { file: String, error: String },
#[error("cannot stat {file}: {error}")]
CannotStat { file: String, error: String },
}
mod options {
pub const DEREFERENCE: &str = "dereference";
pub const FILE_SYSTEM: &str = "file-system";
pub const FORMAT: &str = "format";
pub const PRINTF: &str = "printf";
pub const TERSE: &str = "terse";
pub const BSD_SHELL: &str = "bsd-shell";
pub const BSD_TIMEFMT: &str = "bsd-timefmt";
pub const FILES: &str = "files";
}
#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]
struct Flags {View on GitHub (pinned to 9690622007)
Solutions
- Verify the path exists and is reachable (`ls -ld <file>`), then retry the command.
- Check whether the filesystem containing the path is mounted (`mount | grep <dir>`); remount if needed.
- If sandboxed, grant access to the underlying filesystem devices/procfs required for filesystem queries.
- Read the wrapped `error` field for the specific errno and address it (permissions, stale NFS handle, etc.).
Example fix
// before: stale NFS mount stat --file-system /mnt/nfs/data // cannot read file system information // after: remount then query // mount -t nfs server:/export /mnt/nfs stat --file-system /mnt/nfs/data
Defensive patterns
Strategy: retry
Validate before calling
import { accessSync, constants } from 'node:fs';
try { accessSync(path, constants.F_OK); } catch { throw new Error(`path unreachable before filesystem stat: ${path}`); } Try / catch
try {
await stat.run(['--file-system', path]);
} catch (err) {
if (String(err).startsWith('cannot read file system information')) {
// remount or surface wrapped error to caller
throw new Error(`filesystem for ${path} unreachable: ${err}`);
} else throw err;
} Prevention
- Confirm the mount backing the path is healthy before filesystem-mode stat.
- Avoid racing: re-verify existence immediately before the call.
- In sandboxes, grant read access to procfs/sysfs needed for filesystem queries.
When it happens
Trigger: Running `stat --file-system <file>` where the syscall used to resolve the file's filesystem (e.g. statvfs/statfs) fails for that specific path.
Common situations: The file is on a network or FUSE mount whose backing service is gone; the path disappeared between listing and stat (race); permission issues in chroot/containers; stale automount entries.
Related errors
- cannot read table of mounted file systems: {error}
- Too many levels of symbolic links
- {}: {error}
- failed to create a unique fc temporary file
- 2
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e14414ce41094a45.
Report an issue: GitHub.