tauri-apps/tauri · error · Error::GenericError

Git options --tag, --rev and --branch can only be used with

Error message

Git options --tag, --rev and --branch can only be used with official Tauri plugins

What it means

`tauri add <plugin>` accepts `--tag`, `--rev`, and `--branch` only for plugins in the built-in `known_plugins` table, because for those the CLI hardcodes the git source as `tauri-apps/tauri-plugin-<name>`. For any other plugin name (`is_known == false`) there is no known repository to attach a git ref to, so the options are rejected up front.

Source

Thrown at crates/tauri-cli/src/add.rs:68

    .map(|(p, v)| (p, Some(v)))
    .unwrap_or((&options.plugin, None));

  let mut plugins = crate::helpers::plugins::known_plugins();
  let (metadata, is_known) = plugins
    .remove(plugin)
    .map(|metadata| (metadata, true))
    .unwrap_or_default();

  let plugin_snake_case = plugin.replace('-', "_");
  let crate_name = format!("tauri-plugin-{plugin}");
  let npm_name = if is_known {
    format!("@tauri-apps/plugin-{plugin}")
  } else {
    format!("tauri-plugin-{plugin}-api")
  };

  if !is_known && (options.tag.is_some() || options.rev.is_some() || options.branch.is_some()) {
    crate::error::bail!(
      "Git options --tag, --rev and --branch can only be used with official Tauri plugins"
    );
  }

  let frontend_dir = resolve_frontend_dir();

  let target_str = metadata
    .desktop_only
    .then_some(r#"cfg(not(any(target_os = "android", target_os = "ios")))"#)
    .or_else(|| {
      metadata
        .mobile_only
        .then_some(r#"cfg(any(target_os = "android", target_os = "ios"))"#)
    });

  let cargo_version_req = version.or(metadata.version_req.as_deref());

  cargo::install_one(cargo::CargoInstallOptions {

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Drop the git flags and let the CLI resolve the plugin by name from the registry (e.g. `tauri add my-community-plugin`)
  2. Install the third-party plugin manually with the git source you want: `cargo add --git https://github.com/user/tauri-plugin-my-community-plugin --tag v1.2.0` plus the matching npm package, then run `tauri permission add my-community-plugin:default`
  3. If you expected the plugin to be official, check its exact name in the Tauri plugins list — a typo makes it 'unknown'

Example fix

# before
tauri add sql --branch next          # fine (official)
tauri add log2 --tag v1.0.0          # error: log2 is not an official plugin

# after
tauri add log2                        # registry install
cargo add --git https://github.com/user/tauri-plugin-log2 --tag v1.0.0   # manual pin
Defensive patterns

Strategy: validation

Validate before calling

# only pass git flags for plugins in the official set
OFFICIAL="autostart barcode-recognition battery deep-link dialog fs global-shortcut http log notification opener os process barcode positioner shell sql uploader tray updater websocket window nagivation nfc haptics barcode-reader"
plugin="$1"; shift
case " $OFFICIAL " in
  *" $plugin "*) exec tauri add "$plugin" "$@" ;;
  *) git_flags=''; for a in "$@"; do case "$a" in --tag*|--rev*|--branch*) ;; *) git_flags="$git_flags $a";; esac; done
     exec tauri add "$plugin" $git_flags ;;
esac

Prevention

When it happens

Trigger: Running `tauri add my-community-plugin --tag v1.2.0` (or with `--rev`/`--branch`) where `my-community-plugin` is not in the official known-plugins list.

Common situations: Trying to pin a specific version of a third-party Tauri plugin the same way you would for an official one; copy-pasting an official-plugin command and swapping the name; plugins whose crates.io/npm names differ from the repo slug.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/0f225cd41a48d87c. Report an issue: GitHub.