{"record":{"id":"99639cc0bd103a3c","repo":"leptos-rs/leptos","slug":"keyword-argument-repeated-input","errorCode":null,"errorMessage":"keyword argument repeated: `input`","messagePattern":"keyword argument repeated: `input`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1119,"sourceCode":"                        }\n                        encoding = Some(stream.parse()?);\n                    } else if key == \"endpoint\" {\n                        if fn_path.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `endpoint`\",\n                            ));\n                        }\n                        fn_path = Some(stream.parse()?);\n                    } else if key == \"input\" {\n                        if encoding.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"`encoding` and `input` should not both be \\\n                                 specified\",\n                            ));\n                        } else if input.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `input`\",\n                            ));\n                        }\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 \\","sourceCodeStart":1101,"sourceCodeEnd":1137,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1101-L1137","documentation":"This error is raised when the `input` keyword argument appears more than once in a #[server] attribute. Because `input` names the custom request-body type, a second value would be contradictory, so the parser rejects the duplicate at compile time with a span on the repeated key.","triggerScenarios":"Writing #[server(input = A, input = B)] in the same attribute, or a macro_rules! wrapper injecting `input` while the user already supplied one.","commonSituations":"Copy-paste of attribute args between functions, refactoring where a type was renamed and both old and new `input` lines remained, or generated macro layers that each add input.","solutions":["Keep only one `input = ...` entry and delete the other.","If different input types are needed for variants, define separate server functions.","Fix macro wrappers to append `input` only when not already present."],"exampleFix":"// before\n#[server(input = MyInput, input = OtherInput)]\nasync fn save(data: MyInput) -> Result<(), ServerFnError> { todo!() }\n\n// after\n#[server(input = MyInput)]\nasync fn save(data: MyInput) -> Result<(), ServerFnError> { todo!() }","handlingStrategy":"validation","validationCode":"// Pre-commit check for duplicate `input` args:\n// grep -rnE '#\\[server\\([^)\\n]*input\\s*=[^)\\n]*input\\s*=' src/ && exit 1 || exit 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One `input = ...` per attribute; rename, don't append.","When changing input types, replace the old line rather than adding a new one.","Audit macro_rules! wrappers that inject `input` for collision with user args.","Compile in CI so macro parse errors are caught before merge."],"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"}