can1357/oh-my-pi · error · CatError
unknown filetype: {ft_debug}
Error message
unknown filetype: {ft_debug} What it means
`CatError::UnknownFiletype { ft_debug }` is raised when `cat` inspects a file's type via `metadata`/`FileType` and finds something it has no reader for — not a regular file, socket, or any known device type. The `ft_debug` field carries the debug representation of the file type so the message shows what unrecognized kind was encountered. It is a defensive fallback in the file-type dispatch logic ported from uutils coreutils.
Source
Thrown at crates/pi-builtins/src/cat.rs:76
fn to_str(&self) -> &[u8] {
&self.buf[self.print_start..]
}
fn write(&self, writer: &mut impl Write) -> io::Result<()> {
writer.write_all(self.to_str())
}
}
#[derive(Error, Debug)]
enum CatError {
/// Wrapper around `io::Error`.
#[error("{}", strip_errno(.0))]
Io(io::Error),
/// The downstream reader closed its pipe; this ends the copy quietly.
#[error("broken pipe")]
BrokenPipe,
/// Unknown file type; it is not a regular file, socket, or known device.
#[error("unknown filetype: {ft_debug}")]
UnknownFiletype { ft_debug: String },
#[error("Is a directory")]
IsDirectory,
#[cfg(unix)]
#[error("No such device or address")]
NoSuchDeviceOrAddress,
#[error("Too many levels of symbolic links")]
TooManySymlinks,
}
impl From<io::Error> for CatError {
fn from(error: io::Error) -> Self {
if error.kind() == ErrorKind::BrokenPipe {
Self::BrokenPipe
} else {
Self::Io(error)
}
}View on GitHub (pinned to 9690622007)
Solutions
- Inspect the printed `ft_debug` value to learn what file type was seen.
- Use `ls -l`/`stat` on the path to confirm what the object is.
- Avoid cat-ing that object; if it should be readable, check the filesystem/driver, or report the missing file-type support upstream.
Example fix
// before $ cat /mnt/fuse/weird-node unknown filetype: FileType(0x...) // after $ stat /mnt/fuse/weird-node # identify it, then use the right reader
Defensive patterns
Strategy: validation
Validate before calling
// shell: only cat objects that are regular files
for p in "$@"; do
if [ ! -f "$p" ] && [ ! -p "$p" ] && [ ! -c "$p" ]; then
echo "skipping unsupported file type: $p" >&2
continue
fi
cat -- "$p"
done Type guard
// Rust caller: inspect the reported file type
if let CatError::UnknownFiletype { ft_debug } = &err {
eprintln!("unsupported file type: {ft_debug}");
} Try / catch
// shell: skip unknown types instead of aborting if ! cat -- "$p" 2>/dev/null; then echo "could not read $p (unsupported type?)" >&2 fi
Prevention
- Stat unusual paths before cat-ing them; restrict operands to regular files.
- Be cautious with paths on FUSE/network filesystems that may report exotic file types.
- Report persistent unknown-type cases to the brush/uutils maintainers with the ft_debug value.
When it happens
Trigger: `cat` on a path whose `FileType::is_file()`, socket check, and all `FileTypeExt` device checks fail — e.g. exotic filesystem node types; directory-like or fifo cases may be handled by other variants, so this fires only for types outside the implemented dispatch.
Common situations: Cat-ing unusual filesystem objects on network/overlay/FUSE filesystems that report odd file types; running on a platform where a file type maps to no known category; scripts accidentally passing a special node path.
Related errors
- Is a directory
- unknown function: {0}
- unknown key binding function: {0}
- unimplemented: {0}
- I/O error occurred
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/042b6b5fda70f612.
Report an issue: GitHub.