{"record":{"id":"0164ff05c9907f9c","repo":"leptos-rs/leptos","slug":"encoding-not-found","errorCode":null,"errorMessage":"Encoding not found.","messagePattern":"Encoding not found\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1230,"sourceCode":"                        ));\n                    }\n                }\n            } else if lookahead.peek(LitStr) {\n                if use_key_and_value {\n                    return Err(syn::Error::new(\n                        stream.span(),\n                        \"If you use keyword arguments (e.g., `name` = \\\n                         Something), then you can no longer use arguments \\\n                         without a keyword.\",\n                    ));\n                }\n                match arg_pos {\n                    1 => return Err(lookahead.error()),\n                    2 => prefix = Some(stream.parse()?),\n                    3 => encoding = Some(stream.parse()?),\n                    4 => fn_path = Some(stream.parse()?),\n                    _ => {\n                        return Err(syn::Error::new(\n                            stream.span(),\n                            \"unexpected extra argument\",\n                        ))\n                    }\n                }\n            } else {\n                return Err(lookahead.error());\n            }\n\n            if !stream.is_empty() {\n                stream.parse::<Token![,]>()?;\n            }\n        }\n\n        // parse legacy encoding into input/output\n        let mut builtin_encoding = false;\n        if let Some(encoding) = encoding {\n            match encoding.value().to_lowercase().as_str() {","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1212-L1248","documentation":"The `encoding` option (or third positional string) is validated against the set of built-in encodings known to the macro (e.g. Url, GetJson, PostJson, PostCbor, etc., matched case-insensitively). Any other value fails this check with 'Encoding not found.' at the encoding literal's span.","triggerScenarios":"#[server(encoding = \"json\")] (lowercase name not in the builtin list); misspelling like 'PostJSon' variants that don't match; passing an encoding name from a different framework; using a custom encoding that requires input/output/custom instead.","commonSituations":"Copying encodings from other libraries (e.g. 'msgpack' when only Cbor is builtin); typos in the encoding string; switching to custom serialization without switching options.","solutions":["Use one of the supported builtin encoding strings (Url, GetText, PostText, GetBinary, PostBinary, GetJson, PostJson, PostCbor, GetCBOR-style idents are matched case-insensitively).","For non-builtin serialization, omit `encoding` and specify `input`/`output` (and optionally `custom`) types instead.","Check spelling/case and any recent renames of encodings in the crate docs."],"exampleFix":"// before\n#[server(encoding = \"msgpack\")]\n// after\n#[server(encoding = \"PostCbor\")]\n// or for custom:\n// #[server(input = MyInput, output = MyOutput)]","handlingStrategy":"validation","validationCode":"const BUILTIN_ENCODINGS: &[&str] = &[\"url\",\"gettext\",\"posttext\",\"getbinary\",\"postbinary\",\"getjson\",\"postjson\",\"postcbor\"];\nlet enc = \"msgpack\";\nassert!(BUILTIN_ENCODINGS.contains(&enc.to_lowercase().as_str()), \"unsupported encoding: {enc}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy encoding names from the crate docs, not memory","Use input/output/custom for anything non-builtin","Add a CI grep test listing allowed encodings used in the repo"],"tags":["rust","proc-macro","encoding","invalid-value"],"backgroundTag":"invalid-encoding-value","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}