{"record":{"id":"0c385c843c9653a4","repo":"leptos-rs/leptos","slug":"keyword-argument-repeated-output","errorCode":null,"errorMessage":"keyword argument repeated: `output`","messagePattern":"keyword argument repeated: `output`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1135,"sourceCode":"                            ));\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 \\\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                        }","sourceCodeStart":1117,"sourceCodeEnd":1153,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1117-L1153","documentation":"This error is thrown when the `output` keyword argument is repeated in a #[server] attribute. `output` designates the custom response type; a second occurrence is ambiguous, so the parser rejects it at compile time with a span on the duplicate key.","triggerScenarios":"Writing #[server(output = A, output = B)] in one attribute, or a macro_rules! wrapper that injects `output` while the user already specified one.","commonSituations":"Copy-paste of attribute lines, renaming an output type and leaving both entries, generated macro layers each adding output.","solutions":["Keep a single `output = ...` entry and delete the rest.","Use separate server functions if different output types are required.","Make macro wrappers conditionally emit `output` only when absent."],"exampleFix":"// before\n#[server(output = Json<MyOutput>, output = MyOutput)]\nasync fn load() -> Result<MyOutput, ServerFnError> { todo!() }\n\n// after\n#[server(output = MyOutput)]\nasync fn load() -> Result<MyOutput, ServerFnError> { todo!() }","handlingStrategy":"validation","validationCode":"// Pre-commit check for duplicate `output` args:\n// grep -rnE '#\\[server\\([^)\\n]*output\\s*=[^)\\n]*output\\s*=' src/ && exit 1 || exit 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare `output` at most once per attribute.","When changing output types, edit the existing entry instead of adding a new one.","Review macro wrappers that append `output` automatically.","Rely on cargo check in CI to surface duplicate-key errors."],"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"}