{"record":{"id":"e3a0776ec3a382f0","repo":"tauri-apps/tauri","slug":"only-one-of-tag-rev-and-branch-can-be-speci-e3a077","errorCode":null,"errorMessage":"Only one of --tag, --rev and --branch can be specified","messagePattern":"Only one of --tag, --rev and --branch can be specified","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/helpers/cargo.rs","lineNumber":44,"sourceCode":"  } else {\n    cargo.arg(options.name);\n\n    if options.tag.is_some() || options.rev.is_some() || options.branch.is_some() {\n      cargo.args([\"--git\", \"https://github.com/tauri-apps/plugins-workspace\"]);\n    }\n\n    match (options.tag, options.rev, options.branch) {\n      (Some(tag), None, None) => {\n        cargo.args([\"--tag\", tag]);\n      }\n      (None, Some(rev), None) => {\n        cargo.args([\"--rev\", rev]);\n      }\n      (None, None, Some(branch)) => {\n        cargo.args([\"--branch\", branch]);\n      }\n      (None, None, None) => {}\n      _ => 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\");","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/helpers/cargo.rs#L26-L62","documentation":"The cargo helper that installs Rust dependencies maps `(tag, rev, branch)` onto `cargo add --git ... --tag/--rev/--branch`. The match arms accept exactly one of the three or none; the catch-all arm rejects any request with two or more git refs, since cargo itself only accepts a single ref per git dependency.","triggerScenarios":"Calling `tauri add <plugin> --tag X --branch Y` (or any pair among `--tag`/`--rev`/`--branch`) for an official plugin — the same flags reach this helper when the CLI wires up the Cargo dependency.","commonSituations":"Scripts that pass all git flags defensively; trying to pin a rev on a branch; copying flag combinations between commands.","solutions":["Pass exactly one git ref: `--tag <tag>` or `--rev <sha>` or `--branch <name>`","If you need a specific commit, `--rev` alone is enough — remove the others","For no git install, remove all three flags"],"exampleFix":"# before\ntauri add sql --rev abc123 --branch main\n\n# after\ntauri add sql --rev abc123","handlingStrategy":"validation","validationCode":"# wrapper: reject more than one git ref before calling tauri add\nseen=0\nfor a in \"$@\"; do case \"$a\" in --tag|--rev|--branch) seen=$((seen+1));; esac; done\n[ \"$seen\" -le 1 ] || { echo 'at most one of --tag/--rev/--branch'; exit 1; }\ntauri add \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose one ref type per install: tag, rev, or branch — never several","Encode the choice in one variable in scripts so combinations are impossible","Validate flags in wrappers around `tauri add` used by automation"],"tags":["tauri-cli","cargo","git","cli-flags","mutually-exclusive"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}