sxyazi/yazi · error

Fetchers exceed the limit of {MAX_FETCHERS}

Error message

Fetchers exceed the limit of {MAX_FETCHERS}

What it means

The number of fetchers loaded from configuration is capped at `MAX_FETCHERS` (a u8-sized bound, since each fetcher's slot index is stored as a `u8`). The `TryFrom<Vec<FetcherArc>>` conversion — used when the fetcher set is built/loaded — rejects lists longer than that cap with this error. The cap exists because the `mime()` dispatch path indexes a fixed-size array of task buckets by `fetcher.idx`.

Source

Thrown at yazi-config/src/plugin/fetchers.rs:27

use yazi_shim::{arc_swap::{ArcSwapExt, IntoPointee}, vec::VecExt};

use super::{Fetcher, MAX_FETCHERS};
use crate::{mix, plugin::{FetcherArc, FetcherMatcher, fetcher_rev}};

#[derive(Debug, Default, Deserialize)]
pub struct Fetchers(ArcSwap<Vec<FetcherArc>>);

impl Deref for Fetchers {
	type Target = ArcSwap<Vec<FetcherArc>>;

	fn deref(&self) -> &Self::Target { &self.0 }
}

impl TryFrom<Vec<FetcherArc>> for Fetchers {
	type Error = anyhow::Error;

	fn try_from(inner: Vec<FetcherArc>) -> Result<Self> {
		ensure!(inner.len() <= MAX_FETCHERS as usize, "Fetchers exceed the limit of {MAX_FETCHERS}");

		Ok(Self(Self::reindex(inner).into_pointee()))
	}
}

impl Fetchers {
	pub fn mime(&self, files: Vec<File>) -> impl Iterator<Item = (FetcherArc, Vec<File>)> {
		let fetchers = self.load_full();
		let mut tasks: [Vec<_>; MAX_FETCHERS as usize] = Default::default();

		for file in files {
			let found = FetcherMatcher::new(&fetchers, &file, "").find(|f| f.group == "mime");
			if let Some(fetcher) = found {
				tasks[fetcher.idx as usize].push(file);
			} else {
				warn!("No mime fetcher for {file:?}");
			}
		}

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Reduce the number of fetcher rules in `yazi.toml` to `MAX_FETCHERS` or fewer
  2. Merge/deduplicate rules: one fetcher entry can match multiple mime types or globs via its `if`/matchers
  3. Increase coverage of each rule with broader globs instead of adding near-duplicate entries

Example fix

# before (yazi.toml)
[[plugin.fetchers]]
mime = "text/*"
[[plugin.fetchers]]
mime = "text/*"
# ... (more than MAX_FETCHERS entries)

// after — merge overlapping rules into one
[[plugin.fetchers]]
mime = "text/*"
[[plugin.fetchers]]
name = "*.{jpg,png}"
Defensive patterns

Strategy: validation

Validate before calling

-- Lua: check fetcher count before committing config/registration
local n = 0
for _ in pairs(my_fetchers) do n = n + 1 end
assert(n <= 10, "too many fetchers; merge or prune rules") -- 10 = MAX_FETCHERS

Prevention

When it happens

Trigger: Constructing `Fetchers` from more than `MAX_FETCHERS` fetcher entries — i.e. a yazi config (`plugin.yazi`/fetcher rules) or plugin-provided fetcher list whose length exceeds the cap.

Common situations: Users who stack many fetcher rules in `yazi.toml` (`[plugin]` fetchers) without pruning duplicates; plugins or setup scripts that programmatically append fetchers unboundedly before the set is committed; config merges accumulating entries across reloads.

Related errors


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