tauri-apps/tauri · error · anyhow::Error
The `{}` dependency features on the `Cargo.toml` file
Error message
The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.
Please run `tauri dev` or `tauri build` or {}.
What it means
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.
Source
Thrown at crates/tauri-build/src/manifest.rs:72
.filter(|f| f != &"tray-icon")
.map(|f| f.to_string())
.collect::<Vec<String>>(),
},
];
for metadata in dependencies {
let mut name = metadata.name.clone();
let mut deps = find_dependency(manifest, &metadata.name, metadata.kind);
if deps.is_empty() {
if let Some(alias) = &metadata.alias {
deps = find_dependency(manifest, alias, metadata.kind);
name.clone_from(alias);
}
}
for dep in deps {
if let Err(error) = check_features(dep, &metadata) {
return Err(anyhow!("
The `{}` dependency features on the `Cargo.toml` file does not match the allowlist defined under `tauri.conf.json`.
Please run `tauri dev` or `tauri build` or {}.
", name, error));
}
}
}
Ok(())
}
fn find_dependency(manifest: &mut Manifest, name: &str, kind: DependencyKind) -> Vec<Dependency> {
let dep = match kind {
DependencyKind::Build => manifest.build_dependencies.remove(name),
DependencyKind::Normal => manifest.dependencies.remove(name),
};
if let Some(dep) = dep {
vec![dep]View on GitHub (pinned to 2f1cd75b0f)
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
Example fix
# before: tauri.conf.json disables the fs API but Cargo.toml still has it
[dependencies]
tauri = { version = "1", features = ["fs-read-file"] }
# after: run `tauri dev` (CLI rewrites the features) or edit manually
tauri = { version = "1", features = [] } Defensive patterns
Strategy: validation
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Permission {} not found, expected one of {}
- {:?} does not exist
- {:?} is not a file
- Library not found: {}
- Framework path should have .framework extension: {}
AI-assisted analysis of tauri-apps/tauri@2f1cd75b0f (2026-08-16).
Data as JSON: /api/errors/0f87feb12d646dfd.
Report an issue: GitHub.