{"record":{"id":"ee75e219ec530a8d","repo":"DioxusLabs/dioxus","slug":"encoding-and-input-should-not-both-be-specifie","errorCode":null,"errorMessage":"`encoding` and `input` should not both be specified","messagePattern":"`encoding` and `input` should not both be specified","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fullstack-macro/src/lib.rs","lineNumber":1590,"sourceCode":"                    } 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                        }\n                        input = Some(stream.parse()?);\n                    } else if key == \"input_derive\" {\n                        if input_derive.is_some() {\n                            return Err(syn::Error::new(\n                                key.span(),\n                                \"keyword argument repeated: `input_derive`\",\n                            ));\n                        }","sourceCodeStart":1572,"sourceCodeEnd":1608,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-macro/src/lib.rs#L1572-L1608","documentation":"`encoding` and `input` are mutually exclusive in `#[server(...)]`: `encoding` already defines the input codec. The parser explicitly rejects `input = ...` when `encoding` was set earlier in the same attribute (packages/fullstack-macro/src/lib.rs:1588-1594).","triggerScenarios":"`#[server(encoding = Postcard, input = Json)]`; partial migration from the old `encoding` API to the split `input`/`output` API where `encoding` was left behind; adding `input` while keeping `encoding` 'just in case'.","commonSituations":"Upgrading Dioxus/server-fn versions where `input`/`output` were introduced alongside legacy `encoding`; tutorials mixing old and new styles.","solutions":["Remove `encoding` and specify both directions explicitly: `input = Json, output = Json`.","Or remove `input` and keep `encoding` if both directions use the same codec (legacy style).","Standardize the codebase on `input`/`output` to avoid this class of conflict entirely."],"exampleFix":"// before\n#[server(encoding = Postcard, input = Json)]\nasync fn save(data: Data) { ... }\n\n// after\n#[server(input = Json, output = Postcard)]\nasync fn save(data: Data) { ... }","handlingStrategy":"validation","validationCode":"# Fail when encoding coexists with input or output in one #[server] attribute\nimport re, sys\nfor m in re.finditer(r'#\\[server\\(([^)]*)\\)\\]', open('src/server_fns.rs').read(), re.S):\n    body = m.group(1)\n    if re.search(r'\\bencoding\\s*=', body) and re.search(r'\\b(input|output)\\s*=', body):\n        sys.exit('encoding must not be combined with input/output: ' + body[:60])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Choose one style per function: legacy encoding= alone, or explicit input=/output= alone.","During upgrades, treat any leftover encoding= as tech debt to convert in the same PR."],"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"}