tauri-apps/tauri · error · syn::Error
unexpected list input
Error message
unexpected list input
What it means
The #[tauri::command] attribute parser accepts only flat, comma-separated meta items: rename_all = "...", rename = "...", root = "...", and the bare async flag. A list-shaped sub-attribute (identifier followed by a parenthesized group) has no meaning to the wrapper macro and is rejected at compile time with 'unexpected list input', spanned over the whole attribute.
Source
Thrown at crates/tauri-macros/src/command/wrapper.rs:59
execution_context: ExecutionContext,
argument_case: ArgumentCase,
rename: RenamePolicy,
}
impl Parse for WrapperAttributes {
fn parse(input: ParseStream) -> syn::Result<Self> {
let mut wrapper_attributes = WrapperAttributes {
root: quote!(::tauri),
execution_context: ExecutionContext::Blocking,
argument_case: ArgumentCase::Camel,
rename: RenamePolicy::Keep,
};
let attrs = Punctuated::<WrapperAttributeKind, Token![,]>::parse_terminated(input)?;
for attr in attrs {
match attr {
WrapperAttributeKind::Meta(Meta::List(_)) => {
return Err(syn::Error::new(input.span(), "unexpected list input"));
}
WrapperAttributeKind::Meta(Meta::NameValue(v)) => {
if v.path.is_ident("rename_all") {
if let Expr::Lit(ExprLit {
lit: Lit::Str(s),
attrs: _,
}) = v.value
{
wrapper_attributes.argument_case = match s.value().as_str() {
"snake_case" => ArgumentCase::Snake,
"camelCase" => ArgumentCase::Camel,
_ => {
return Err(syn::Error::new(
s.span(),
"expected \"camelCase\" or \"snake_case\"",
))
}
};View on GitHub (pinned to 52e4b6e71d)
Solutions
- Use name=value syntax: #[tauri::command(rename_all = "snake_case")]
- Remember the only accepted keys are rename_all, rename, root — plus the bare word async
- Remove nested options; the macro has no list-form arguments in any version
Example fix
// before
#[tauri::command(rename_all(snake_case))]
fn do_thing(custom_arg: u32) {}
// after
#[tauri::command(rename_all = "snake_case")]
fn do_thing(custom_arg: u32) {} Defensive patterns
Strategy: validation
Prevention
- Use flat key = value syntax inside #[tauri::command(...)]
- Only rename_all, rename, root (with values) and the bare word async are accepted
- Copy command attribute examples from the docs matching your pinned tauri version
When it happens
Trigger: Writing #[tauri::command(rename_all(snake_case))], #[tauri::command(rename(my_name))], or any key(value) group inside the command attribute. The Punctuated<WrapperAttributeKind, Token![,]> parse succeeds on the outer list, then each Meta::List item trips this error.
Common situations: Muscle memory from other attribute macros that use nested-list syntax; adapting code from older/other frameworks; a typo replacing `= value` with `(value)`.
Related errors
- unexpected input, expected one of `rename_all`, `rename`, `r
- expected "camelCase" or "snake_case"
- expected string literal for rename
- unable to use self as a command function parameter
- only named, wildcard, struct, and tuple struct arguments all
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/a0da62c59a3a8afe.
Report an issue: GitHub.