sxyazi/yazi · error
ctime not available
Error message
ctime not available
What it means
Cha::ctime_dur converts the file's change time to a Duration since the Unix epoch and bails when ctime is None. ctime is normally populated on Unix, but some filesystems/API paths leave it unset, in which case the Option is None. Called by add_fields when emitting file metadata fields.
Source
Thrown at yazi-fs/src/cha/cha.rs:194
Ok(atime.duration_since(UNIX_EPOCH)?)
} else {
bail!("atime not available");
}
}
pub(crate) fn btime_dur(self) -> anyhow::Result<Duration> {
if let Some(btime) = self.btime {
Ok(btime.duration_since(UNIX_EPOCH)?)
} else {
bail!("btime not available");
}
}
pub(crate) fn ctime_dur(self) -> anyhow::Result<Duration> {
if let Some(ctime) = self.ctime {
Ok(ctime.duration_since(UNIX_EPOCH)?)
} else {
bail!("ctime not available");
}
}
pub fn mtime_dur(self) -> anyhow::Result<Duration> {
if let Some(mtime) = self.mtime {
Ok(mtime.duration_since(UNIX_EPOCH)?)
} else {
bail!("mtime not available");
}
}
}
View on GitHub (pinned to 5f901b886b)
Solutions
- Check ctime availability (cha.ctime.is_some()) before calling and skip the field when None.
- Fall back to mtime for change-time display.
- Fix the platform metadata collection path so ctime gets populated.
Example fix
// before
fields.insert("ctime", cha.ctime_dur()?.as_millis());
// after
if let Ok(ctime) = cha.ctime_dur() {
fields.insert("ctime", ctime.as_millis());
} Defensive patterns
Strategy: fallback
Validate before calling
if cha.ctime().is_none() { /* skip field or use mtime */ } Type guard
fn has_ctime(cha: Cha) -> bool { cha.ctime().is_some() } Try / catch
let ctime = cha.ctime_dur().ok().or_else(|| cha.mtime_dur().ok());
Prevention
- Handle partial stat data from FUSE/virtual filesystems
- Emit metadata fields independently so one missing value doesn't abort all fields
- Verify the platform collection path populates ctime
When it happens
Trigger: Calling ctime_dur() (e.g. from add_fields) on a Cha whose ctime was never populated — typically platform-specific code paths where the underlying stat metadata did not include ctime.
Common situations: FUSE/virtual filesystems that report incomplete stat data; platform abstractions that return None for ctime; synthetic Cha values built manually without ctime.
Related errors
- atime not available
- btime not available
- mtime not available
- Failed to join new name with CWD
- Cannot create file at root
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/3efae4c281789768.
Report an issue: GitHub.