{"record":{"id":"51e1e058d9a2e001","repo":"DioxusLabs/dioxus","slug":"keyword-argument-repeated-prefix","errorCode":null,"errorMessage":"keyword argument repeated: `prefix`","messagePattern":"keyword argument repeated: `prefix`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":1566,"sourceCode":"            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`\",\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`\",","sourceCodeStart":1548,"sourceCodeEnd":1584,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L1548-L1584","documentation":"`prefix` sets the URL prefix for a `#[server]` function's endpoint and may be given at most once. The macro's keyword parser errors on the second `prefix = ...` it encounters (packages/fullstack-macro/src/lib.rs:1564-1570).","triggerScenarios":"`#[server(prefix = \"/api\", prefix = \"/v2\")]`; combining `#[server(prefix = \"/api\")]` with another attribute line that also sets `prefix` after a merge; appending a second prefix while trying to build a nested path.","commonSituations":"Trying to compose prefixes (`/api` + `/v1`) — the macro does not concatenate them; merge conflicts; copy-paste of a fully-configured attribute onto a function that already had one.","solutions":["Keep a single `prefix` entry and spell out the full prefix: `prefix = \"/api/v1\"`.","If you need per-crate or per-module prefixes, use one `prefix` in the macro and add the rest via your router/mount path.","Check for duplicated attribute lines after resolving git merges."],"exampleFix":"// before\n#[server(prefix = \"/api\", prefix = \"/v1\")]\nasync fn get_user() -> User { ... }\n\n// after\n#[server(prefix = \"/api/v1\")]\nasync fn get_user() -> User { ... }","handlingStrategy":"validation","validationCode":"# Reuse the duplicate-key checker from index 93; prefix is in its key list.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compose full prefixes in one string ('/api/v1') — the macro never concatenates prefix values.","Keep environment-specific prefixes in one const per crate instead of per-function 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"}