tauri-apps/tauri · error · syn::Error

unexpected input, expected one of `rename_all`, `rename`…

Error message

unexpected input, expected one of `rename_all`, `rename`, `root`, `async`

What it means

Compile-time syn::Error raised by the #[tauri::command] macro's attribute parser when an unrecognized attribute argument appears in the command wrapper attribute list. Only the literal attributes rename_all, rename, root and async are accepted; any other bare path attribute (a Meta::Path) triggers this error at proc-macro expansion time.

Solutions

  1. Use only supported keys: rename_all = "...", rename = "...", root = ..., or the bare flag async
  2. Fix the typo so the key matches a supported identifier exactly
  3. Remove extraneous attributes not part of the Tauri command macro

Example fix

// before
#[tauri::command(renameall = "camelCase")]
// after
#[tauri::command(rename_all = "camelCase")]
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Typing an unsupported key in the command attribute, e.g. #[tauri::command(window)], #[tauri::command(fast)], or a misspelled key like renameall = "camelCase" (parsed as a path) — anything Meta::Path.

Common situations: Typos in supported attribute names; copying attributes from other macros (e.g. serde, wasm_bindgen) onto tauri::command; forgetting the '= value' part so a name-value becomes a path.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/1894d8e6c9c5a167. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri-macros/src/command/wrapper.rs:110

          } else if v.path.is_ident("root") {
            if let Expr::Lit(ExprLit {
              lit: Lit::Str(s),
              attrs: _,
            }) = v.value
            {
              let lit = s.value();

              wrapper_attributes.root = if lit == "crate" {
                quote!($crate)
              } else {
                let ident = Ident::new(&lit, Span::call_site());
                quote!(#ident)
              };
            }
          }
        }
        WrapperAttributeKind::Meta(Meta::Path(_)) => {
          return Err(syn::Error::new(
            input.span(),
            "unexpected input, expected one of `rename_all`, `rename`, `root`, `async`",
          ));
        }
        WrapperAttributeKind::Async => {
          wrapper_attributes.execution_context = ExecutionContext::Async;
        }
      }
    }

    Ok(wrapper_attributes)
  }
}

/// The execution context of the command.
enum ExecutionContext {
  Async,
  Blocking,

View on GitHub (pinned to 460ec35447)