{"record":{"id":"079a3530810f7689","repo":"DioxusLabs/dioxus","slug":"keyword-argument-repeated-encoding","errorCode":null,"errorMessage":"keyword argument repeated: `encoding`","messagePattern":"keyword argument repeated: `encoding`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":1574,"sourceCode":"                    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`\",\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 \\","sourceCodeStart":1556,"sourceCodeEnd":1592,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L1556-L1592","documentation":"`encoding` is the legacy shortcut in `#[server(...)]` that sets both input and output codecs (e.g. `encoding = postcard`). It may be specified only once; the parser rejects a second `encoding = ...` (packages/fullstack-macro/src/lib.rs:1572-1578).","triggerScenarios":"`#[server(encoding = Json, encoding = Postcard)]`; adding `encoding` when migrating an old attribute that already had one; trying to use different codecs for request vs response via two `encoding` keys.","commonSituations":"Upgrading old server functions that used `encoding` while also adding a new one; misunderstanding that per-direction configuration uses `input = ...` / `output = ...`, not repeated `encoding`.","solutions":["Delete the duplicate so one `encoding = ...` remains.","For mixed codecs, drop `encoding` entirely and use `input = Json, output = Postcard` (one each).","Prefer the explicit `input`/`output` form in new code; it composes and errors like this one disappear."],"exampleFix":"// before\n#[server(encoding = Json, encoding = Postcard)]\nasync fn ping() -> i32 { ... }\n\n// after\n#[server(input = Json, output = Postcard)]\nasync fn ping() -> i32 { ... }","handlingStrategy":"validation","validationCode":"# Reuse the duplicate-key checker from index 93; encoding is in its key list.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["New code: use input=/output=, never encoding=, so per-direction intent is explicit.","Sweep the repo for `encoding =` when upgrading Dioxus versions and migrate all at once."],"tags":["dioxus","proc-macro","server-functions","serialization","macro-args","compile-time"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}