tauri-apps/tauri · error
Only one of --tag, --rev and --branch can be specified
Error message
Only one of --tag, --rev and --branch can be specified
What it means
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.
Source
Thrown at crates/tauri-cli/src/helpers/cargo.rs:44
} else {
cargo.arg(options.name);
if options.tag.is_some() || options.rev.is_some() || options.branch.is_some() {
cargo.args(["--git", "https://github.com/tauri-apps/plugins-workspace"]);
}
match (options.tag, options.rev, options.branch) {
(Some(tag), None, None) => {
cargo.args(["--tag", tag]);
}
(None, Some(rev), None) => {
cargo.args(["--rev", rev]);
}
(None, None, Some(branch)) => {
cargo.args(["--branch", branch]);
}
(None, None, None) => {}
_ => crate::error::bail!("Only one of --tag, --rev and --branch can be specified"),
};
}
if let Some(target) = options.target {
cargo.args(["--target", target]);
}
if let Some(cwd) = options.cwd {
cargo.current_dir(cwd);
}
log::info!("Installing Cargo dependency \"{}\"...", options.name);
let status = cargo.status().map_err(|error| Error::CommandFailed {
command: "cargo add".to_string(),
error,
})?;
if !status.success() {
crate::error::bail!("Failed to install Cargo dependency");View on GitHub (pinned to 52e4b6e71d)
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
Example fix
# before tauri add sql --rev abc123 --branch main # after tauri add sql --rev abc123
Defensive patterns
Strategy: validation
Validate before calling
# wrapper: reject more than one git ref before calling tauri add
seen=0
for a in "$@"; do case "$a" in --tag|--rev|--branch) seen=$((seen+1));; esac; done
[ "$seen" -le 1 ] || { echo 'at most one of --tag/--rev/--branch'; exit 1; }
tauri add "$@" Prevention
- 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
When it happens
Trigger: 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.
Common situations: Scripts that pass all git flags defensively; trying to pin a rev on a branch; copying flag combinations between commands.
Related errors
- Only one of --tag, --rev and --branch can be specified
- Git options --tag, --rev and --branch can only be used with
- Failed to install Cargo dependency
- Failed to remove Cargo dependency
- Library not found at {}. Make sure your Cargo.toml file has
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/e3a0776ec3a382f0.
Report an issue: GitHub.