tauri-apps/tauri · error · syn::Error
unknown attribute {name}
Error message
unknown attribute {name} What it means
#[tauri::generate_context] has a fixed vocabulary: an optional leading string literal (the config file path), then the keys capabilities, assets and test. Any other name=value key falls into the catch-all arm and the macro stops with `unknown attribute {name}`, echoing the offending key so the typo is obvious.
Source
Thrown at crates/tauri-macros/src/context.rs:110
));
}
}
"assets" => {
assets.replace(v.value);
}
"test" => {
if let Expr::Lit(ExprLit {
lit: Lit::Bool(LitBool { value, .. }),
..
}) = v.value
{
test = value;
} else {
return Err(syn::Error::new(input.span(), "unexpected value for test"));
}
}
name => {
return Err(syn::Error::new(
input.span(),
format!("unknown attribute {name}"),
));
}
}
}
Meta::List(_) => {
return Err(syn::Error::new(input.span(), "unexpected list input"));
}
}
let _ = input.parse::<Token![,]>();
}
Ok(Self {
config_file: config_file
.unwrap_or_else(|| {
std::env::var("CARGO_MANIFEST_DIR")View on GitHub (pinned to 52e4b6e71d)
Solutions
- Pass the config path as the first bare argument: #[tauri::generate_context("tauri.conf.json")] or with no argument for the default lookup
- Limit keys to capabilities, assets and test
- Match examples to the exact tauri/tauri-macros version pinned in Cargo.lock
Example fix
// before
#[tauri::generate_context(config = "tauri.conf.json")]
// after
#[tauri::generate_context("tauri.conf.json")] Defensive patterns
Strategy: validation
Prevention
- Only capabilities, assets and test keys exist; the config path is a leading bare string
- Copy the macro invocation from the official example for your version
- Treat IDE suggestions for attribute keys as unverified until they compile
When it happens
Trigger: #[tauri::generate_context(config = "tauri.conf.json")] — the config path is written as a bare leading string literal, not a config = key; also invented keys like env, mode, source, or misspellings such as capability.
Common situations: Assuming a key=value API for the config path; following outdated blog posts or examples from a different tauri version; IDE completion suggesting keys that do not exist.
Related errors
- unexpected list input
- unexpected list input
- expected "camelCase" or "snake_case"
- unexpected input, expected one of `rename_all`, `rename`, `r
- unexpected expression for capability
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/4632a85556bd55b6.
Report an issue: GitHub.