{"record":{"id":"0f225cd41a48d87c","repo":"tauri-apps/tauri","slug":"git-options-tag-rev-and-branch-can-only-be","errorCode":null,"errorMessage":"Git options --tag, --rev and --branch can only be used with official Tauri plugins","messagePattern":"Git options --tag, --rev and --branch can only be used with official Tauri plugins","errorType":"validation","errorClass":"Error::GenericError","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/add.rs","lineNumber":68,"sourceCode":"    .map(|(p, v)| (p, Some(v)))\n    .unwrap_or((&options.plugin, None));\n\n  let mut plugins = crate::helpers::plugins::known_plugins();\n  let (metadata, is_known) = plugins\n    .remove(plugin)\n    .map(|metadata| (metadata, true))\n    .unwrap_or_default();\n\n  let plugin_snake_case = plugin.replace('-', \"_\");\n  let crate_name = format!(\"tauri-plugin-{plugin}\");\n  let npm_name = if is_known {\n    format!(\"@tauri-apps/plugin-{plugin}\")\n  } else {\n    format!(\"tauri-plugin-{plugin}-api\")\n  };\n\n  if !is_known && (options.tag.is_some() || options.rev.is_some() || options.branch.is_some()) {\n    crate::error::bail!(\n      \"Git options --tag, --rev and --branch can only be used with official Tauri plugins\"\n    );\n  }\n\n  let frontend_dir = resolve_frontend_dir();\n\n  let target_str = metadata\n    .desktop_only\n    .then_some(r#\"cfg(not(any(target_os = \"android\", target_os = \"ios\")))\"#)\n    .or_else(|| {\n      metadata\n        .mobile_only\n        .then_some(r#\"cfg(any(target_os = \"android\", target_os = \"ios\"))\"#)\n    });\n\n  let cargo_version_req = version.or(metadata.version_req.as_deref());\n\n  cargo::install_one(cargo::CargoInstallOptions {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/add.rs#L50-L86","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Drop the git flags and let the CLI resolve the plugin by name from the registry (e.g. `tauri add my-community-plugin`)","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`","If you expected the plugin to be official, check its exact name in the Tauri plugins list — a typo makes it 'unknown'"],"exampleFix":"# before\ntauri add sql --branch next          # fine (official)\ntauri add log2 --tag v1.0.0          # error: log2 is not an official plugin\n\n# after\ntauri add log2                        # registry install\ncargo add --git https://github.com/user/tauri-plugin-log2 --tag v1.0.0   # manual pin","handlingStrategy":"validation","validationCode":"# only pass git flags for plugins in the official set\nOFFICIAL=\"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\"\nplugin=\"$1\"; shift\ncase \" $OFFICIAL \" in\n  *\" $plugin \"*) exec tauri add \"$plugin\" \"$@\" ;;\n  *) git_flags=''; for a in \"$@\"; do case \"$a\" in --tag*|--rev*|--branch*) ;; *) git_flags=\"$git_flags $a\";; esac; done\n     exec tauri add \"$plugin\" $git_flags ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the plugin appears in the official Tauri plugins list before using `--tag/--rev/--branch`","For third-party plugins, pin versions by installing manually with `cargo add --git ... --tag` and the npm equivalent","Wrap `tauri add` in scripts that strip unsupported flags for non-official names"],"tags":["tauri-cli","plugin-management","git","cli-flags","validation"],"backgroundTag":"unsupported-flag-combination","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}