sxyazi/yazi · error

Package URL cannot be empty

Error message

Package URL cannot be empty

What it means

Dependency-URL parsing guard in `FromStr for Dependency`: the parent segment before the first ':' is empty (e.g. the input is empty or starts with ':'). Note `splitn` always yields at least one part, so this fires exactly when that first part is the empty string.

Source

Thrown at yazi-cli/src/package/dependency.rs:101

		files.sort_unstable();
		Ok(files)
	}

	pub(super) fn flavor_files() -> Vec<String> {
		["LICENSE", "LICENSE-tmtheme", "README.md", "flavor.toml", "preview.png", "tmtheme.xml"]
			.into_iter()
			.map(Into::into)
			.collect()
	}
}

impl FromStr for Dependency {
	type Err = anyhow::Error;

	fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
		let mut parts = s.splitn(2, ':');

		let Some(parent) = parts.next() else { bail!("Package URL cannot be empty") };
		let child = parts.next().unwrap_or_default();

		let Some((_, repo)) = parent.split_once('/') else {
			bail!("Package URL `{parent}` must be in the format `owner/repository`")
		};

		let name = if child.is_empty() { repo } else { child };
		if !name.as_bytes().kebab_cased() {
			bail!("Package name `{name}` must be in kebab-case")
		}

		Ok(Self {
			r#use: s.to_owned(),
			name: format!("{name}.yazi"),
			parent: format!("{parent}{}", if child.is_empty() { ".yazi" } else { "" }),
			child: if child.is_empty() { String::new() } else { format!("{child}.yazi") },
			..Default::default()
		})

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Provide a package URL of the form `owner/repository` or `owner/repository:child`.
  2. Trim whitespace and verify the string is non-empty before parsing.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at yazi-cli/src/package/dependency.rs:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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