{"record":{"id":"7afa557ce724a402","repo":"leptos-rs/leptos","slug":"unexpected-extra-argument","errorCode":null,"errorMessage":"unexpected extra argument","messagePattern":"unexpected extra argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1217,"sourceCode":"                    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()?),\n                    4 => fn_path = Some(stream.parse()?),\n                    _ => {\n                        return Err(syn::Error::new(\n                            stream.span(),\n                            \"unexpected extra argument\",\n                        ))\n                    }\n                }","sourceCodeStart":1199,"sourceCodeEnd":1235,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1199-L1235","documentation":"Positional string-literal arguments are limited to four slots (prefix at 2, encoding at 3, endpoint at 4 after the struct name). Any further string literal in the #[server] attribute exceeds the known positional signature and is rejected as an extra argument.","triggerScenarios":"#[server(MyFn, \"api\", \"Url\", \"endpoint\", \"extra\")] — five string literals; passing a note or comment-like string inside the attribute; leftover arguments after copying a template attribute.","commonSituations":"Users who assumed arbitrary trailing strings were accepted, or who kept an argument that a recent version of the macro no longer consumes after a signature change.","solutions":["Remove the surplus string literal(s) beyond the four allowed positional slots.","Convert needed options to keyword form so intent is explicit (encoding = \"Url\", etc.).","Check the current macro docs for the accepted argument list after upgrading the crate."],"exampleFix":"// before\n#[server(MyFn, \"api\", \"Url\", \"my_endpoint\", \"extra\")]\n// after\n#[server(MyFn, \"api\", \"Url\", \"my_endpoint\")]","handlingStrategy":"validation","validationCode":"// Positional strings allowed: prefix, encoding, endpoint (max 3 after name).\nfn too_many_positional(attr: &str) -> bool {\n    let strs = attr.matches ('\"').count() / 2;\n    strs > 3\n}\nassert!(!too_many_positional(\"#[server(MyFn, \\\"a\\\", \\\"b\\\", \\\"c\\\", \\\"d\\\")]\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Limit to name + prefix + encoding + endpoint positionally","Switch extra options to keyword form","Re-check accepted arguments after upgrading the crate"],"tags":["rust","proc-macro","parse-error","too-many-arguments"],"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"}