{"record":{"id":"d7f01dc2e8199470","repo":"tauri-apps/tauri","slug":"expected-camelcase-or-snake-case","errorCode":null,"errorMessage":"expected \"camelCase\" or \"snake_case\"","messagePattern":"expected \"camelCase\" or \"snake_case\"","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-macros/src/command/wrapper.rs","lineNumber":72,"sourceCode":"\n    let attrs = Punctuated::<WrapperAttributeKind, Token![,]>::parse_terminated(input)?;\n    for attr in attrs {\n      match attr {\n        WrapperAttributeKind::Meta(Meta::List(_)) => {\n          return Err(syn::Error::new(input.span(), \"unexpected list input\"));\n        }\n        WrapperAttributeKind::Meta(Meta::NameValue(v)) => {\n          if v.path.is_ident(\"rename_all\") {\n            if let Expr::Lit(ExprLit {\n              lit: Lit::Str(s),\n              attrs: _,\n            }) = v.value\n            {\n              wrapper_attributes.argument_case = match s.value().as_str() {\n                \"snake_case\" => ArgumentCase::Snake,\n                \"camelCase\" => ArgumentCase::Camel,\n                _ => {\n                  return Err(syn::Error::new(\n                    s.span(),\n                    \"expected \\\"camelCase\\\" or \\\"snake_case\\\"\",\n                  ))\n                }\n              };\n            }\n          } else if v.path.is_ident(\"rename\") {\n            if let Expr::Lit(ExprLit {\n              lit: Lit::Str(s), ..\n            }) = v.value\n            {\n              let lit = s.value();\n              wrapper_attributes.rename = RenamePolicy::Rename(quote!(#lit));\n            } else {\n              return Err(syn::Error::new(\n                v.span(),\n                \"expected string literal for rename\",\n              ));","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-macros/src/command/wrapper.rs#L54-L90","documentation":"rename_all on #[tauri::command] controls how Rust argument names are exposed to the frontend, and supports exactly two values: \"camelCase\" (default) and \"snake_case\". The parser matches the string literal against those exact spellings and rejects anything else, with the error span on the string literal itself so it points at the bad value.","triggerScenarios":"#[tauri::command(rename_all = \"PascalCase\")], \"snakeCase\", \"SCREAMING_SNAKE_CASE\", \"kebab-case\", or any casing variant that is not byte-for-byte camelCase or snake_case.","commonSituations":"Porting serde rename_all vocabulary (which supports many more cases) to tauri commands; capitalization typos like \"Snake_Case\"; assuming the frontend framework's naming convention is accepted.","solutions":["Use exactly #[tauri::command(rename_all = \"snake_case\")] or \"camelCase\"","If you need another casing on the JS side, wrap/rename the arguments in the frontend call instead","Check the tauri command docs for your pinned version for the current accepted set"],"exampleFix":"// before\n#[tauri::command(rename_all = \"PascalCase\")]\nfn get_user(user_id: u32) {}\n// after\n#[tauri::command(rename_all = \"camelCase\")]\nfn get_user(user_id: u32) {} // JS calls invoke('get_user', { userId: 32 })","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["rename_all accepts exactly \"camelCase\" or \"snake_case\"","Do not port serde's wider rename_all vocabulary to tauri commands","Let rust-analyzer surface the error before commit; the span points at the bad string"],"tags":["macros","command","rename","attributes","compile-time"],"backgroundTag":"macro-attribute-syntax-error","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}