{"record":{"id":"e14414ce41094a45","repo":"can1357/oh-my-pi","slug":"cannot-read-file-system-information-for-file-e","errorCode":null,"errorMessage":"cannot read file system information for {file}: {error}","messagePattern":"cannot read file system information for (.+?): (.+?)","errorType":"error_code","errorClass":"StatError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/stat.rs","lineNumber":148,"sourceCode":"NOTE: your shell may have its own version of stat, which usually supersedes\nthe version described here.  Please refer to your shell's documentation\nfor details about the options it supports.\";\n\n\t#[derive(Debug, Error)]\n\tenum StatError {\n\t\t#[error(\"Invalid quoting style: {style}\")]\n\t\tInvalidQuotingStyle { style: String },\n\t\t#[error(\"missing operand\\nTry 'stat --help' for more information.\")]\n\t\tMissingOperand,\n\t\t#[error(\"{directive}: invalid directive\")]\n\t\tInvalidDirective { directive: String },\n\t\t#[error(\"cannot read table of mounted file systems: {error}\")]\n\t\t#[cfg_attr(not(unix), allow(dead_code, reason = \"mount tables are unix-only\"))]\n\t\tCannotReadFilesystem { error: String },\n\t\t#[error(\"using '-' to denote standard input does not work in file system mode\")]\n\t\t#[cfg_attr(not(unix), allow(dead_code, reason = \"stdin filesystem mode is unix-only\"))]\n\t\tStdinFilesystemMode,\n\t\t#[error(\"cannot read file system information for {file}: {error}\")]\n\t\tCannotReadFilesystemInfo { file: String, error: String },\n\t\t#[error(\"cannot stat {file}: {error}\")]\n\t\tCannotStat { file: String, error: String },\n\t}\n\n\tmod options {\n\t\tpub const DEREFERENCE: &str = \"dereference\";\n\t\tpub const FILE_SYSTEM: &str = \"file-system\";\n\t\tpub const FORMAT: &str = \"format\";\n\t\tpub const PRINTF: &str = \"printf\";\n\t\tpub const TERSE: &str = \"terse\";\n\t\tpub const BSD_SHELL: &str = \"bsd-shell\";\n\t\tpub const BSD_TIMEFMT: &str = \"bsd-timefmt\";\n\t\tpub const FILES: &str = \"files\";\n\t}\n\n\t#[derive(Default, Debug, PartialEq, Eq, Clone, Copy)]\n\tstruct Flags {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/stat.rs#L130-L166","documentation":"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.","triggerScenarios":"Running `stat --file-system <file>` where the syscall used to resolve the file's filesystem (e.g. statvfs/statfs) fails for that specific path.","commonSituations":"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.","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.)."],"exampleFix":"// before: stale NFS mount\nstat --file-system /mnt/nfs/data  // cannot read file system information\n\n// after: remount then query\n// mount -t nfs server:/export /mnt/nfs\nstat --file-system /mnt/nfs/data","handlingStrategy":"retry","validationCode":"import { accessSync, constants } from 'node:fs';\ntry { accessSync(path, constants.F_OK); } catch { throw new Error(`path unreachable before filesystem stat: ${path}`); }","typeGuard":null,"tryCatchPattern":"try {\n  await stat.run(['--file-system', path]);\n} catch (err) {\n  if (String(err).startsWith('cannot read file system information')) {\n    // remount or surface wrapped error to caller\n    throw new Error(`filesystem for ${path} unreachable: ${err}`);\n  } else throw err;\n}","preventionTips":["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."],"tags":["filesystem","io","stat","unix"],"backgroundTag":"filesystem-metadata-unavailable","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}