{"record":{"id":"46b6a1fd5d213935","repo":"tauri-apps/tauri","slug":"missing-cargo-dev-instruction-please-update-tau","errorCode":null,"errorMessage":"missing `cargo:dev` instruction, please update tauri to latest","messagePattern":"missing `cargo:dev` instruction, please update tauri to latest","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-build/src/lib.rs","lineNumber":468,"sourceCode":"  ///\n  /// See [`AppManifest`] for more information.\n  pub fn app_manifest(mut self, manifest: AppManifest) -> Self {\n    self.app_manifest = manifest;\n    self\n  }\n\n  #[cfg(feature = \"codegen\")]\n  #[cfg_attr(docsrs, doc(cfg(feature = \"codegen\")))]\n  #[must_use]\n  pub fn codegen(mut self, codegen: codegen::context::CodegenContext) -> Self {\n    self.codegen.replace(codegen);\n    self\n  }\n}\n\npub fn is_dev() -> bool {\n  env::var_os(\"DEP_TAURI_DEV\")\n    .expect(\"missing `cargo:dev` instruction, please update tauri to latest\")\n    == \"true\"\n}\n\n/// Run all build time helpers for your Tauri Application.\n///\n/// To provide extra configuration, such as [`AppManifest::commands`]\n/// for fine-grained control over command permissions, see [`try_build`].\n/// See [`Attributes`] for the complete list of configuration options.\n///\n/// # Platforms\n///\n/// [`build()`] should be called inside of `build.rs` regardless of the platform, so **DO NOT** use a [conditional compilation]\n/// check that prevents it from running on any of your targets.\n///\n/// Platform specific code is handled by the helpers automatically.\n///\n/// A build script is required in order to activate some cargo environmental variables that are\n/// used when generating code and embedding assets.","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-build/src/lib.rs#L450-L486","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (Cargo.toml)\ntauri = \"1\"\ntauri-build = \"2\"\n// after\ntauri = \"2\"\ntauri-build = \"2\"","handlingStrategy":"try-catch","validationCode":"if std::env::var_os(\"DEP_TAURI_DEV\").is_none() {\n  panic!(\"DEP_TAURI_DEV missing: ensure `tauri` is a dependency and versions match tauri-build\");\n}","typeGuard":null,"tryCatchPattern":"// In build script context you cannot catch a panic; guard instead:\nlet is_dev = std::env::var_os(\"DEP_TAURI_DEV\")\n  .map(|v| v == \"true\")\n  .unwrap_or_else(|| panic!(\"tauri/tauri-build version mismatch: run cargo update && cargo clean\"));","preventionTips":["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."],"tags":["build","environment","version-mismatch","tauri"],"backgroundTag":"missing-env-var","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}