{"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/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-build/src/lib.rs#L450-L486","documentation":"tauri_build::is_dev() reads the DEP_TAURI_DEV environment variable, which Cargo only sets when the linked tauri runtime crate's build script prints cargo:dev=<bool> (crates/tauri/build.rs:261) through its links declaration. The expect fires when that variable is absent, i.e. the tauri crate actually linked is older than the tauri-build crate driving the build. It is a version-lock assertion between the two crates, not a general environment problem.","triggerScenarios":"Calling tauri_build::build() (which calls is_dev()) in build.rs while the project pairs a newer tauri-build with an older tauri runtime crate that never emits cargo:dev — typically after upgrading only one crate, or when Cargo.lock resolves a stale tauri.","commonSituations":"Upgrading tauri-build without upgrading tauri (or vice versa) during a v1-to-v2 migration; stale lockfile after editing versions; workspace members pinning different tauri/tauri-build releases; using a fork of tauri predating the cargo:dev instruction.","solutions":["Update both crates in lockstep: set tauri and tauri-build to the same latest 2.x line in Cargo.toml, then run cargo update -p tauri -p tauri-build","Run cargo tree -i tauri (and -i tauri-build) to find which member or dependency pins the mismatched version, and align it","If the lockfile is stale, delete the relevant lock entries or run a plain cargo update after fixing Cargo.toml","For a forked tauri, either cherry-pick the build-script change that emits cargo:dev or match tauri-build to the fork's era"],"exampleFix":"// Cargo.toml (src-tauri) — before\n[build-dependencies]\ntauri-build = \"2\"\n[dependencies]\ntauri = \"1.6\"\n\n// after — both on the same line\n[build-dependencies]\ntauri-build = \"2\"\n[dependencies]\ntauri = \"2\"","handlingStrategy":"validation","validationCode":"# CI preflight: tauri and tauri-build must share the same version line\nv1=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name==\"tauri\") | .version' | head -1)\nv2=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name==\"tauri-build\") | .version' | head -1)\n[ \"${v1%%.*}\" = \"${v2%%.*}\" ] || { echo \"tauri $v1 vs tauri-build $v2 mismatch\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// build.rs — catch the panic and print an actionable message\nlet result = std::panic::catch_unwind(tauri_build::build);\nif result.is_err() {\n  eprintln!(\"tauri-build failed; most likely tauri and tauri-build versions are out of sync — align both to the same release\");\n  std::process::exit(1);\n}","preventionTips":["Treat tauri and tauri-build as one unit: upgrade them together in the same commit","Add a CI check comparing the two versions in Cargo.lock and fail on a major/minor mismatch","After editing versions, run cargo update -p tauri -p tauri-build so the lockfile matches"],"tags":["tauri-build","build-script","env-var","version-mismatch","rust"],"backgroundTag":"dependency-version-mismatch","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}