tauri-apps/tauri · error
missing `cargo:dev` instruction, please update tauri to…
Error message
missing `cargo:dev` instruction, please update tauri to latest
What it means
tauri-build's is_dev reads the `DEP_TAURI_DEV` environment variable, which is exported by the `tauri` crate via a `cargo:` link instruction (`cargo:dev=...`) during the build. If the variable is absent, the expect panics, meaning tauri-build ran without the matching tauri dependency emitting the instruction — typically a version mismatch between the `tauri` and `tauri-build` crates.
Solutions
- Align versions: use matching major versions of `tauri`, `tauri-build`, and the tauri CLI in Cargo.toml (`cargo update`).
- Ensure the crate calling tauri_build also depends on `tauri` (the DEP_ variable comes from tauri's build script).
- Clean the build cache with `cargo clean` so all build scripts re-run and re-export link variables.
- Run `cargo tree -p tauri -p tauri-build` to check for duplicated or mismatched versions in the lockfile.
Example fix
// before (Cargo.toml) tauri = "1" tauri-build = "2" // after tauri = "2" tauri-build = "2"
Defensive patterns
Strategy: try-catch
Validate before calling
if std::env::var_os("DEP_TAURI_DEV").is_none() {
panic!("DEP_TAURI_DEV missing: ensure `tauri` is a dependency and versions match tauri-build");
} Try / catch
// In build script context you cannot catch a panic; guard instead:
let is_dev = std::env::var_os("DEP_TAURI_DEV")
.map(|v| v == "true")
.unwrap_or_else(|| panic!("tauri/tauri-build version mismatch: run cargo update && cargo clean")); Prevention
- Keep `tauri` and `tauri-build` on the same major version; bump them together.
- Run `cargo clean` after upgrading tauri crates so build scripts re-export DEP_ variables.
- Audit with `cargo tree` for duplicate tauri versions before releasing.
When it happens
Trigger: Running `tauri_build::try_build` in a crate that depends on `tauri-build` without (or with an incompatible version of) the `tauri` crate that exports `DEP_TAURI_DEV`; stale build cache after upgrading one crate but not the other.
Common situations: Mixing tauri 1.x and 2.x crates (e.g. `tauri-build = "2"` with `tauri = "1"`); calling tauri-build directly in a build script without tauri as a dependency; cargo not re-running the dependency build script after a partial upgrade.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Permission not found, expected one of
- The `frontendDist` configuration is set to
- unable to autogenerate
- Android NDK invalid. Make sure the NDK_HOME environment…
- Android NDK not found. Make sure the NDK is installed and…
AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18).
Data as JSON: /api/errors/46b6a1fd5d213935.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tauri-build/src/lib.rs:468
///
/// See [`AppManifest`] for more information.
pub fn app_manifest(mut self, manifest: AppManifest) -> Self {
self.app_manifest = manifest;
self
}
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
#[must_use]
pub fn codegen(mut self, codegen: codegen::context::CodegenContext) -> Self {
self.codegen.replace(codegen);
self
}
}
pub fn is_dev() -> bool {
env::var_os("DEP_TAURI_DEV")
.expect("missing `cargo:dev` instruction, please update tauri to latest")
== "true"
}
/// Run all build time helpers for your Tauri Application.
///
/// To provide extra configuration, such as [`AppManifest::commands`]
/// for fine-grained control over command permissions, see [`try_build`].
/// See [`Attributes`] for the complete list of configuration options.
///
/// # Platforms
///
/// [`build()`] should be called inside of `build.rs` regardless of the platform, so **DO NOT** use a [conditional compilation]
/// check that prevents it from running on any of your targets.
///
/// Platform specific code is handled by the helpers automatically.
///
/// A build script is required in order to activate some cargo environmental variables that are
/// used when generating code and embedding assets.View on GitHub (pinned to 460ec35447)