{"record":{"id":"4b229116f7dcd21d","repo":"leptos-rs/leptos","slug":"keyword-argument-repeated-server","errorCode":null,"errorMessage":"keyword argument repeated: `server`","messagePattern":"keyword argument repeated: `server`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1141,"sourceCode":"                        }\n                        input = Some(stream.parse()?);\n                    } else if key == \"input_derive\" {\n                        if input_derive.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `input_derive`\",\n                            ));\n                        }\n                        input_derive = Some(stream.parse()?);\n                    } else if key == \"output\" {\n                        if encoding.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"`encoding` and `output` should not both be \\\n                                 specified\",\n                            ));\n                        } else if output.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `output`\",\n                            ));\n                        }\n                        output = Some(stream.parse()?);\n                    } else if key == \"server\" {\n                        if server.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `server`\",\n                            ));\n                        }\n                        server = Some(stream.parse()?);\n                    } else if key == \"client\" {\n                        if client.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `client`\",","sourceCodeStart":1123,"sourceCodeEnd":1159,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1123-L1159","documentation":"The #[server] macro parser throws this when the `server` keyword argument appears more than once. `server` overrides the server-side function/block used to run the handler; duplicates are ambiguous, so the attribute parser rejects them at compile time.","triggerScenarios":"Writing #[server(server = path1, server = path2)] in one attribute, or a macro wrapper adding a `server` override on top of a user-supplied one.","commonSituations":"Copy-pasting args, refactoring where the server override path changed and both lines stayed, layered macro_rules! wrappers each injecting `server`.","solutions":["Remove the duplicate `server = ...` entry, keeping the intended override.","If no override is needed, drop all `server` args to use the default behavior.","Adjust macro wrappers to emit `server` only when the caller did not."],"exampleFix":"// before\n#[server(server = crate::custom_server, server = crate::other_server)]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }\n\n// after\n#[server(server = crate::custom_server)]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }","handlingStrategy":"validation","validationCode":"// Pre-commit check for duplicate `server` args:\n// grep -rnE '#\\[server\\([^)\\n]*server\\s*=[^)\\n]*server\\s*=' src/ && exit 1 || exit 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only one `server = ...` override per attribute.","Centralize the server override path in a constant to avoid divergent copies.","When changing overrides, delete the old entry in the same commit.","Run cargo check locally and in CI; these errors are compile-time only."],"tags":["rust","proc-macro","compile-time","server-fn"],"backgroundTag":"duplicate-macro-attribute-argument","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}