sxyazi/yazi · error
btime not available
Error message
btime not available
What it means
Cha::btime_dur converts the file's birth (creation) time to a Duration since the Unix epoch and bails when btime is None. Birth time is only reported on some platforms (macOS, Windows, recent Linux via statx), so on others it is always None. Callers include add_fields and hash_u128 which build extra file fields.
Source
Thrown at yazi-fs/src/cha/cha.rs:186
#[inline]
const fn is_reparse(self) -> bool { self.kind.contains(ChaKind::REPARSE) }
#[inline]
pub fn is_indirect(self) -> bool { self.is_link() || self.is_reparse() }
pub(crate) fn atime_dur(self) -> anyhow::Result<Duration> {
if let Some(atime) = self.atime {
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
- Guard with cha.btime.is_some() (or btime()) and omit/hide the creation-time field when absent.
- Fall back to ctime or mtime as an approximation when btime is missing.
- On Linux, ensure the code path uses statx where available to actually populate btime.
Example fix
// before
fields.insert("btime", cha.btime_dur()?.as_millis());
// after
if let Ok(btime) = cha.btime_dur() {
fields.insert("btime", btime.as_millis());
} Defensive patterns
Strategy: fallback
Validate before calling
if cha.btime().is_none() { /* omit or fall back */ } Type guard
fn has_btime(cha: Cha) -> bool { cha.btime().is_some() } Try / catch
let btime = cha.btime_dur().ok(); // None on platforms without birth time
if let Some(b) = btime { /* emit field */ } Prevention
- Gate creation-time UI/features on platform capability
- On Linux use statx to actually obtain btime where supported
- Provide mtime/ctime fallbacks for display purposes
When it happens
Trigger: Calling btime_dur() (directly or via add_fields/hash_u128) on a Cha from a platform/filesystem that does not expose creation time — e.g. Linux stat() without statx, ext4 without crtime, NFS.
Common situations: Running a btime-dependent feature (like displaying 'Created' column) on Linux filesystems that don't report crtime; older kernels lacking statx support.
Related errors
- atime not available
- ctime 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/fb2d50d60fb162fa.
Report an issue: GitHub.