{"record":{"id":"372d26e99760b99b","repo":"leptos-rs/leptos","slug":"keyword-argument-repeated-custom","errorCode":null,"errorMessage":"keyword argument repeated: `custom`","messagePattern":"keyword argument repeated: `custom`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1157,"sourceCode":"                            ));\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`\",\n                            ));\n                        }\n                        client = Some(stream.parse()?);\n                    } else if key == \"custom\" {\n                        if custom_wrapper.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `custom`\",\n                            ));\n                        }\n                        custom_wrapper = Some(stream.parse()?);\n                    } else if key == \"impl_from\" {\n                        if impl_from.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `impl_from`\",","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1139-L1175","documentation":"The #[server] macro parser errors when the `custom` keyword argument appears more than once. `custom` supplies a custom wrapper type for the server function; since the wrapper stored in custom_wrapper can only hold one value, duplicates are rejected at compile time.","triggerScenarios":"Writing #[server(custom = A, custom = B)] in one attribute, or a macro_rules! layer appending `custom` when the user already set it.","commonSituations":"Copy-pasted attribute args, composing wrapper macros that each add a custom wrapper, refactoring the wrapper type without removing the old entry.","solutions":["Keep a single `custom = ...` entry and delete the duplicate.","If multiple wrapper behaviors are needed, combine them into one wrapper type instead of two `custom` args.","Update wrapper macros to emit `custom` only when not already present."],"exampleFix":"// before\n#[server(custom = WrapperA, custom = WrapperB)]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }\n\n// after\n#[server(custom = WrapperA)]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }","handlingStrategy":"validation","validationCode":"// Pre-commit check for duplicate `custom` args:\n// grep -rnE '#\\[server\\([^)\\n]*custom\\s*=[^)\\n]*custom\\s*=' src/ && exit 1 || exit 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One `custom = ...` wrapper per attribute.","Compose behaviors into a single wrapper type instead of stacking `custom` args.","Make wrapper macros conditional when the user already sets `custom`.","Run cargo check before committing macro-based code."],"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"}