sxyazi/yazi · error

atime not available

Error message

atime not available

What it means

Cha::atime_dur converts the file's access time to a Duration since the Unix epoch, and bails when the atime field is None. Some platforms or filesystems simply do not report atime, so Cha stores it as an Option. This is a 'data not available' error, not an I/O failure.

Source

Thrown at yazi-fs/src/cha/cha.rs:178

			self.kind.contains(ChaKind::HIDDEN) || self.kind.contains(ChaKind::SYSTEM),
			self.kind.contains(ChaKind::HIDDEN)
		)
	}

	#[inline]
	pub const fn is_dummy(self) -> bool { self.kind.contains(ChaKind::DUMMY) }

	#[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");
		}
	}

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Check cha.atime.is_some() (or use atime()) before requesting atime_dur, and skip the field when absent.
  2. Fall back to mtime when atime is unavailable.
  3. Restrict atime-based features to platforms/filesystems known to populate atime.

Example fix

// before
let age = cha.atime_dur()?;
// after
let age = cha.atime().map(|t| t.elapsed()).unwrap_or_else(|_| cha.mtime_dur().unwrap_or_default());
Defensive patterns

Strategy: fallback

Validate before calling

if cha.atime().is_none() { /* use mtime instead */ }

Type guard

fn has_atime(cha: Cha) -> bool { cha.atime().is_some() }

Try / catch

let dur = cha.atime_dur().unwrap_or_else(|_| cha.mtime_dur().unwrap_or_default());

Prevention

When it happens

Trigger: Calling cha.atime_dur() on a Cha obtained from a filesystem/platform that does not populate atime (e.g. certain network filesystems, or APIs where atime is not returned).

Common situations: Mounts mounted with noatime/relatime where atime is unreliable or absent; virtual filesystems (procfs, squashfs) lacking atime; computing sorting/formatting fields from atime on such entries.

Related errors


AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02). Data as JSON: /api/errors/f460806f968d2f8d. Report an issue: GitHub.