{"record":{"id":"0f87feb12d646dfd","repo":"tauri-apps/tauri","slug":"the-dependency-features-on-the-cargo","errorCode":null,"errorMessage":"\n      The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.\n      Please run `tauri dev` or `tauri build` or {}.\n    ","messagePattern":"\n      The `(.+?)` dependency features on the `Cargo\\.toml` file does not match the allowlist defined under `tauri\\.conf\\.json`\\.\n      Please run `tauri dev` or `tauri build` or (.+?)\\.\n    ","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-build/src/manifest.rs","lineNumber":72,"sourceCode":"        .filter(|f| f != &\"tray-icon\")\n        .map(|f| f.to_string())\n        .collect::<Vec<String>>(),\n    },\n  ];\n\n  for metadata in dependencies {\n    let mut name = metadata.name.clone();\n    let mut deps = find_dependency(manifest, &metadata.name, metadata.kind);\n    if deps.is_empty() {\n      if let Some(alias) = &metadata.alias {\n        deps = find_dependency(manifest, alias, metadata.kind);\n        name.clone_from(alias);\n      }\n    }\n\n    for dep in deps {\n      if let Err(error) = check_features(dep, &metadata) {\n        return Err(anyhow!(\"\n      The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.\n      Please run `tauri dev` or `tauri build` or {}.\n    \", name, error));\n      }\n    }\n  }\n\n  Ok(())\n}\n\nfn find_dependency(manifest: &mut Manifest, name: &str, kind: DependencyKind) -> Vec<Dependency> {\n  let dep = match kind {\n    DependencyKind::Build => manifest.build_dependencies.remove(name),\n    DependencyKind::Normal => manifest.dependencies.remove(name),\n  };\n\n  if let Some(dep) = dep {\n    vec![dep]","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/tauri-apps/tauri/blob/2f1cd75b0f3fb72e6870d719bbfeadedcf8ca884/crates/tauri-build/src/manifest.rs#L54-L90","documentation":"tauri-build keeps two sources of truth in sync: the allowlist/features in tauri.conf.json and the Cargo features enabled on the `tauri` dependency (and build-dependency `tauri-build`) in Cargo.toml. The check() function derives the expected feature set from the config (app features, security pattern like isolation) and compares it with what Cargo.toml declares; on divergence it aborts with this error, appending the precise nested mismatch from check_features.","triggerScenarios":"Running cargo build / tauri dev / tauri build after editing only one side: hand-editing the `tauri = { features = [...] }` line in Cargo.toml, or changing the tauri.conf.json allowlist/features without letting the CLI rewrite the manifest.","commonSituations":"Manually toggling cargo features to work around an issue; git merges that touch tauri.conf.json but not Cargo.toml (or vice versa); following outdated docs that edit Cargo.toml directly.","solutions":["Run `tauri dev` or `tauri build` once - the CLI regenerates the Cargo.toml features to match tauri.conf.json (this is what the message recommends)","Or manually align the features on the `tauri`/`tauri-build` dependencies in src-tauri/Cargo.toml with the config allowlist; the nested error names the exact feature mismatch","Going forward, change the allowlist in tauri.conf.json and re-run the CLI instead of editing Cargo.toml features by hand"],"exampleFix":"# before: tauri.conf.json disables the fs API but Cargo.toml still has it\n[dependencies]\ntauri = { version = \"1\", features = [\"fs-read-file\"] }\n\n# after: run `tauri dev` (CLI rewrites the features) or edit manually\ntauri = { version = \"1\", features = [] }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Change API allowlists only in tauri.conf.json and let `tauri dev`/`tauri build` rewrite Cargo.toml","Never hand-edit the tauri/tauri-build dependency features","In code review, flag PRs that modify tauri.conf.json features or Cargo.toml features in isolation"],"tags":["cargo","features","allowlist","tauri-build","config"],"backgroundTag":null,"analyzedSha":"2f1cd75b0f3fb72e6870d719bbfeadedcf8ca884","analyzedAt":"2026-08-16T04:18:42.486Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}