{"record":{"id":"7f9524f29c22a198","repo":"leptos-rs/leptos","slug":"keyword-argument-repeated-endpoint","errorCode":null,"errorMessage":"keyword argument repeated: `endpoint`","messagePattern":"keyword argument repeated: `endpoint`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1105,"sourceCode":"                    } else if key == \"prefix\" {\n                        if prefix.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `prefix`\",\n                            ));\n                        }\n                        prefix = Some(stream.parse()?);\n                    } else if key == \"encoding\" {\n                        if encoding.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `encoding`\",\n                            ));\n                        }\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                        }","sourceCodeStart":1087,"sourceCodeEnd":1123,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1087-L1123","documentation":"The #[server] macro parser throws this when the `endpoint` keyword argument is specified more than once. `endpoint` sets the custom function path (fn_path); a second occurrence is ambiguous, so compilation fails with a span pointing at the repeated key.","triggerScenarios":"Writing #[server(...)] with two `endpoint = \"...\"` entries, e.g. #[server(endpoint = \"/a\", endpoint = \"/b\")], or a macro wrapper that injects endpoint while the user also wrote one.","commonSituations":"Copy-paste of attribute args, merging two annotations during refactoring, or macro_rules! layers that each add an endpoint.","solutions":["Delete the extra `endpoint = ...` entry, keeping only the desired path.","If different endpoints are needed, declare separate #[server] functions instead.","Audit any macro wrapper so it only adds endpoint when absent."],"exampleFix":"// before\n#[server(endpoint = \"/api/save\", endpoint = \"/api/save-v2\")]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }\n\n// after\n#[server(endpoint = \"/api/save-v2\")]\nasync fn save(data: String) -> Result<(), ServerFnError> { todo!() }","handlingStrategy":"validation","validationCode":"// Pre-commit check for duplicate `endpoint` args in #[server]:\n// grep -rnE '#\\[server\\([^)\\n]*endpoint\\s*=[^)\\n]*endpoint\\s*=' src/ && exit 1 || exit 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare only one endpoint path per server function.","Need different paths? Create separate #[server] functions rather than stacking endpoint args.","Keep endpoint paths centralized (constants) to avoid hand-editing duplicates.","Run cargo check/clippy in CI to catch macro parse errors early."],"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"}