sxyazi/yazi · error

`{}` was not found in package.toml

Error message

`{}` was not found in package.toml

What it means

This error fires from Package::delete when the user asks to remove a dependency (e.g. via `ya pack -d <name>`) whose name/ident does not match any plugin or flavor entry currently present in package.toml. It is a user-input validation guard: the requested `use` string is looked up against existing dependencies with Dependency::identical, and if no entry matches, the delete is aborted. It means the package was never installed or the name/URL was misspelled; nothing in package.toml was modified.

Source

Thrown at yazi-cli/src/package/package.rs:121

			bail!(
				"{} `{}` already exists in package.toml",
				if d.is_flavor { "Flavor" } else { "Plugin" },
				dep.name
			)
		}

		dep.add(false).await?;
		if dep.is_flavor {
			self.flavors.push(dep);
		} else {
			self.plugins.push(dep);
		}
		Ok(())
	}

	async fn delete(&mut self, r#use: &str, discard: bool) -> Result<()> {
		let Some(dep) = self.identical(&Dependency::from_str(r#use)?).cloned() else {
			bail!("`{}` was not found in package.toml", r#use)
		};

		dep.delete(discard).await?;
		if dep.is_flavor {
			self.flavors.retain(|d| !d.identical(&dep));
		} else {
			self.plugins.retain(|d| !d.identical(&dep));
		}
		Ok(())
	}

	async fn save(&self) -> Result<()> {
		let s = toml::to_string_pretty(self)?;
		Local::regular(&Self::toml()).write(s).await.context("Failed to write package.toml")
	}

	fn toml() -> PathBuf { Xdg::config_dir().join("package.toml") }

View on GitHub (pinned to 5f901b886b)

Solutions

  1. List installed packages (`ya pkg list`) and use the exact `owner/repo` or `owner/repo:child` string.
  2. Check for typos or a wrong child name in the dependency spec.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at yazi-cli/src/package/package.rs:121 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/390c7f859207f027. Report an issue: GitHub.