sxyazi/yazi · error

{} `{}` already exists in package.toml

Error message

{} `{}` already exists in package.toml

What it means

Duplicate-dependency guard in `Package::add`: after parsing the new `use` string, an identical plugin or flavor entry already exists in package.toml, so adding it again is rejected to avoid duplicates. The faulting input is the `r#use` string being added.

Source

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

			}
		}

		outln!("Flavors:")?;
		for d in &self.flavors {
			if d.rev.is_empty() {
				outln!("\t{}", d.r#use)?;
			} else {
				outln!("\t{} ({})", d.r#use, d.rev)?;
			}
		}

		Ok(())
	}

	async fn add(&mut self, r#use: &str) -> Result<()> {
		let mut dep = Dependency::from_str(r#use)?;
		if let Some(d) = self.identical(&dep) {
			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)

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Skip adding the dependency — it is already managed.
  2. Update the existing entry instead of adding a new one.
  3. Remove the duplicate with `ya pkg delete` first if you truly want to re-add it.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at yazi-cli/src/package/package.rs:103 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/389ec5c37d7c5c44. Report an issue: GitHub.