sxyazi/yazi · error · anyhow::Error
invalid file mode
Error message
invalid file mode: {value:04o} What it means
Error "invalid file mode: {value:04o}" thrown in sxyazi/yazi.
Solutions
- Provide a valid octal file mode (permission bits in range); fix the value passed to the mode parser.
When it happens
Trigger: Thrown at yazi-fs/src/cha/mode.rs:66 when the library encounters an invalid state.
Common situations: Parsing a mode value whose permission or type bits are not valid for a file mode.
AI-assisted analysis of sxyazi/yazi@441b332de8 (2026-08-19).
Data as JSON: /api/errors/213fb4915cd73200.
Report an issue: GitHub.
Appendix: source
Thrown at yazi-fs/src/cha/mode.rs:66
fn deref(&self) -> &Self::Target {
match *self & Self::T_MASK {
Self::T_FILE => &ChaType::File,
Self::T_DIR => &ChaType::Dir,
Self::T_LINK => &ChaType::Link,
Self::T_BLOCK => &ChaType::Block,
Self::T_CHAR => &ChaType::Char,
Self::T_SOCK => &ChaType::Sock,
Self::T_FIFO => &ChaType::FIFO,
_ => &ChaType::Unknown,
}
}
}
impl TryFrom<u16> for ChaMode {
type Error = anyhow::Error;
fn try_from(value: u16) -> Result<Self, Self::Error> {
let me = Self::from_bits(value).ok_or_else(|| anyhow!("invalid file mode: {value:04o}"))?;
match me & Self::T_MASK {
Self::T_FILE
| Self::T_DIR
| Self::T_LINK
| Self::T_BLOCK
| Self::T_CHAR
| Self::T_SOCK
| Self::T_FIFO => Ok(me),
_ => bail!("invalid file type: {value:04o}"),
}
}
}
#[cfg(unix)]
impl From<ChaMode> for std::fs::Permissions {
fn from(value: ChaMode) -> Self {
use std::os::unix::fs::PermissionsExt;
View on GitHub (pinned to 441b332de8)