{"record":{"id":"9695c661b4940401","repo":"DioxusLabs/dioxus","slug":"keyword-argument-repeated-name","errorCode":null,"errorMessage":"keyword argument repeated: `name`","messagePattern":"keyword argument repeated: `name`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":1558,"sourceCode":"            // Check if this looks like an extractor (Ident : Type)\n            // If so, break out to parse extractors - they must come last\n            if stream.peek(Ident) && stream.peek2(Token![:]) {\n                break;\n            }\n\n            arg_pos += 1;\n            let lookahead = stream.lookahead1();\n            if lookahead.peek(Ident) {\n                let key_or_value: Ident = stream.parse()?;\n\n                let lookahead = stream.lookahead1();\n                if lookahead.peek(Token![=]) {\n                    stream.parse::<Token![=]>()?;\n                    let key = key_or_value;\n                    use_key_and_value = true;\n                    if key == \"name\" {\n                        if struct_name.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `name`\",\n                            ));\n                        }\n                        struct_name = Some(stream.parse()?);\n                    } 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`\",","sourceCodeStart":1540,"sourceCodeEnd":1576,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L1540-L1576","documentation":"The `#[server(...)]` macro parses its arguments as either positional or `key = value` pairs; the `name` key (custom struct name for the generated client type) may be set at most once. A second `name = ...` is rejected at the macro's parse stage (packages/fullstack-macro/src/lib.rs:1556-1562).","triggerScenarios":"`#[server(name = FetchA, name = FetchB)]`; merging two attribute blocks during refactor so `name` appears twice; switching from positional to keyword style and forgetting to delete the first occurrence.","commonSituations":"Copy-pasting server functions and editing attributes incrementally; merge conflicts resolved by keeping both `name =` lines; bulk renames that append rather than replace.","solutions":["Delete one of the `name = ...` entries so exactly one remains.","If two names are genuinely needed, they belong on two separate `#[server]` functions.","After merge conflicts, grep the attribute body for duplicated keys before building."],"exampleFix":"// before\n#[server(name = FetchA, name = FetchB, endpoint = \"https://api.example.com\")]\nasync fn fetch() -> i32 { ... }\n\n// after\n#[server(name = FetchA, endpoint = \"https://api.example.com\")]\nasync fn fetch() -> i32 { ... }","handlingStrategy":"validation","validationCode":"#!/usr/bin/env python3\n# Fail on any repeated key inside a single #[server(...)] attribute.\nimport re, sys, collections\nfor m in re.finditer(r'#\\[server\\(([^)]*)\\)\\]', open('src/server_fns.rs').read(), re.S):\n    keys = re.findall(r'\\b(name|prefix|encoding|endpoint|input|input_derive|output|output_derive|server|client|custom|impl_from|impl_deref|protocol)\\s*=', m.group(1))\n    dupes = [k for k, n in collections.Counter(keys).items() if n > 1]\n    if dupes:\n        sys.exit(f'duplicate #[server] keys: {dupes} in {m.group(1)[:60]!r}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After merge conflicts or scaffolding, grep #[server] bodies for repeated `key =` before building.","Generate attributes from one template/snippet rather than stacking edits."],"tags":["dioxus","proc-macro","server-functions","macro-args","compile-time"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}