{"record":{"id":"425ad05ca11dcd4a","repo":"leptos-rs/leptos","slug":"if-you-use-keyword-arguments-e-g-name-somet","errorCode":null,"errorMessage":"If you use keyword arguments (e.g., `name` = Something), then you can no longer use arguments without a keyword.","messagePattern":"If you use keyword arguments \\(e\\.g\\., `name` = Something\\), then you can no longer use arguments without a keyword\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1209,"sourceCode":"                                \"keyword argument repeated: `protocol`\",\n                            ));\n                        }\n                        protocol = Some(stream.parse()?);\n                    } else {\n                        return Err(lookahead.error());\n                    }\n                } else {\n                    let value = key_or_value;\n                    if use_key_and_value {\n                        return Err(syn::Error::new(\n                            value.span(),\n                            \"positional argument follows keyword argument\",\n                        ));\n                    }\n                    if arg_pos == 1 {\n                        struct_name = Some(value)\n                    } else {\n                        return Err(syn::Error::new(\n                            value.span(),\n                            \"expected string literal\",\n                        ));\n                    }\n                }\n            } else if lookahead.peek(LitStr) {\n                if use_key_and_value {\n                    return Err(syn::Error::new(\n                        stream.span(),\n                        \"If you use keyword arguments (e.g., `name` = \\\n                         Something), then you can no longer use arguments \\\n                         without a keyword.\",\n                    ));\n                }\n                match arg_pos {\n                    1 => return Err(lookahead.error()),\n                    2 => prefix = Some(stream.parse()?),\n                    3 => encoding = Some(stream.parse()?),","sourceCodeStart":1191,"sourceCodeEnd":1227,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1191-L1227","documentation":"The #[server] macro does not allow mixing styles: once a `key = value` keyword argument is seen (use_key_and_value is set), any subsequent argument without a keyword — here a string literal — is rejected with this message. All remaining arguments must use `key = value` form.","triggerScenarios":"#[server(name = \"MyFn\", \"api/prefix\")] — a bare string after a keyword argument; partially converting a legacy positional call to keyword form; appending a new option without its key.","commonSituations":"Developers upgrading from the legacy positional syntax (name, prefix, encoding, endpoint) who convert only the first argument to `name = ...` and leave the rest positional.","solutions":["Convert every remaining positional argument to keyword form: prefix = \"...\", encoding = \"...\", endpoint = \"...\".","Alternatively, drop all keyword arguments and use the legacy positional order with string literals.","Audit the attribute so no bare strings follow any `key = value` pair."],"exampleFix":"// before\n#[server(name = \"MyFn\", \"api\", \"Url\")]\n// after\n#[server(name = \"MyFn\", prefix = \"api\", encoding = \"Url\")]","handlingStrategy":"validation","validationCode":"// Never mix: if any 'key =' appears, every argument must have 'key ='.\nfn style_is_consistent(attr: &str) -> bool {\n    let args: Vec<&str> = attr.trim_matches(|c| c == '[' || c == ']').split(',').map(str::trim).collect();\n    let kw = args.iter().any(|a| a.contains('='));\n    !kw || args.iter().all(|a| a.contains('='))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Convert legacy positional attributes fully to keyword form in one edit","Never append bare strings to keyword-style attributes","Document the project-wide convention: keyword-only arguments"],"tags":["rust","proc-macro","parse-error","argument-style-mixing"],"backgroundTag":"macro-argument-parse-error","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}