{"record":{"id":"c4ce51e69180efb2","repo":"tauri-apps/tauri","slug":"failed-to-install-cargo-dependency","errorCode":null,"errorMessage":"Failed to install Cargo dependency","messagePattern":"Failed to install Cargo dependency","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/helpers/cargo.rs","lineNumber":62,"sourceCode":"      _ => crate::error::bail!(\"Only one of --tag, --rev and --branch can be specified\"),\n    };\n  }\n\n  if let Some(target) = options.target {\n    cargo.args([\"--target\", target]);\n  }\n\n  if let Some(cwd) = options.cwd {\n    cargo.current_dir(cwd);\n  }\n\n  log::info!(\"Installing Cargo dependency \\\"{}\\\"...\", options.name);\n  let status = cargo.status().map_err(|error| Error::CommandFailed {\n    command: \"cargo add\".to_string(),\n    error,\n  })?;\n  if !status.success() {\n    crate::error::bail!(\"Failed to install Cargo dependency\");\n  }\n\n  Ok(())\n}\n\n#[derive(Debug, Default, Clone, Copy)]\npub struct CargoUninstallOptions<'a> {\n  pub name: &'a str,\n  pub cwd: Option<&'a std::path::Path>,\n  pub target: Option<&'a str>,\n}\n\npub fn uninstall_one(options: CargoUninstallOptions) -> crate::Result<()> {\n  let mut cargo = Command::new(\"cargo\");\n  cargo.arg(\"remove\");\n\n  cargo.arg(options.name);\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/helpers/cargo.rs#L44-L80","documentation":"The helper runs `cargo add <name> ...` (inheriting stdio) and checks the exit status. Cargo's own diagnostic has already been printed to the terminal; this error is the CLI's summary that the dependency could not be added to the manifest.","triggerScenarios":"`tauri add <plugin>` where the underlying `cargo add tauri-plugin-<name>` fails: crate version not found, network/registry unreachable, incompatible Rust edition/MSRV, or a Cargo.toml that is locked/read-only.","commonSituations":"Corporate proxies or offline environments blocking crates.io; requesting a plugin version not yet published; cargo not installed or an ancient cargo without `cargo add`; Cargo.toml merge conflicts left in place.","solutions":["Scroll up and read the cargo error printed just above this message — it names the real cause (403 from registry, version not found, etc.)","Reproduce manually: `cargo add tauri-plugin-<name>` inside `src-tauri` and fix what it complains about","For network issues, check proxy/offline settings (`cargo --config net.offline=false`, `~/.cargo/config.toml`) and registry reachability"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# smoke-test cargo registry access and manifest writability before tauri add\ncd src-tauri\ncargo search tauri-plugin-dialog --limit 1 >/dev/null   # fails fast offline / bad proxy\n[ -w Cargo.toml ] || { echo 'Cargo.toml not writable' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-verify network/proxy access to crates.io in restricted environments","Run `cargo add tauri-plugin-<name>` manually once when onboarding a plugin to see real errors","Keep cargo and Cargo.toml healthy (no conflict markers) before plugin installs"],"tags":["tauri-cli","cargo","dependencies","registry","network"],"backgroundTag":"dependency-install-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}