{"record":{"id":"6c2883ccf7e70c3e","repo":"leptos-rs/leptos","slug":"unrecognized-attribute-expected-server","errorCode":null,"errorMessage":"Unrecognized attribute, expected #[server(...)]","messagePattern":"Unrecognized attribute, expected #\\[server\\(\\.\\.\\.\\)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server_fn_macro/src/lib.rs","lineNumber":1425,"sourceCode":"                            \"Unrecognized #[server] attribute, expected \\\n                             #[server(default)] or #[server(rename = \\\n                             \\\"fieldName\\\")]\",\n                        )),\n                    }\n                } else if attr.path().is_ident(\"doc\") {\n                    // Allow #[doc = \"documentation\"]\n                    Ok(attr.clone())\n                } else if attr.path().is_ident(\"allow\") {\n                    // Allow #[allow(...)]\n                    Ok(attr.clone())\n                } else if attr.path().is_ident(\"deny\") {\n                    // Allow #[deny(...)]\n                    Ok(attr.clone())\n                } else if attr.path().is_ident(\"ignore\") {\n                    // Allow #[ignore]\n                    Ok(attr.clone())\n                } else {\n                    Err(Error::new(\n                        attr.span(),\n                        \"Unrecognized attribute, expected #[server(...)]\",\n                    ))\n                }\n            })\n            .collect::<Result<Vec<_>>>()?;\n        arg.attrs = vec![];\n        Ok(ServerFnArg {\n            arg,\n            server_fn_attributes,\n        })\n    }\n}\n\n/// The body of a server function.\n#[derive(Debug, Clone)]\n#[non_exhaustive]\npub struct ServerFnBody {","sourceCodeStart":1407,"sourceCodeEnd":1443,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/server_fn_macro/src/lib.rs#L1407-L1443","documentation":"When collecting the other attributes on the server function item, the macro passes through known/allowed attributes (e.g. #[doc], #[deny(...)], #[ignore] and similar supported ones) and rejects anything else with 'Unrecognized attribute, expected #[server(...)]'.","triggerScenarios":"Placing an attribute the macro doesn't whitelist on the #[server] function, e.g. #[inline], #[deprecated] (depending on version), or a custom proc-macro attribute from another crate that must run before #[server].","commonSituations":"Stacking helper macros from other crates on server functions; cargo-upgrading server_fn and losing support for an attribute previously accepted.","solutions":["Remove the unrecognized attribute from the function.","If it must apply, reorder so the other macro expands before #[server] or apply it to the generated struct via the macro's supported passthrough.","Check the crate version's supported attribute list (doc, cfg, deny/allow, ignore, etc.) and use only those."],"exampleFix":"// before\n#[server]\n#[inline]\nasync fn my_fn() -> Result<(), ServerFnError> { Ok(()) }\n// after\n#[server]\nasync fn my_fn() -> Result<(), ServerFnError> { Ok(()) }","handlingStrategy":"validation","validationCode":"// Whitelist of attributes accepted alongside #[server] (doc, cfg, allow/deny, ignore, ...).\nconst ALLOWED: &[&str] = &[\"doc\", \"cfg\", \"allow\", \"deny\", \"ignore\"];\nlet attr = \"inline\";\nassert!(ALLOWED.contains(&attr), \"attribute #[{attr}] is not accepted next to #[server]\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use well-known rustc lint/doc attributes next to #[server]","Run other proc-macros before #[server] where possible","Re-check the supported attribute list on each crate upgrade"],"tags":["rust","proc-macro","attribute","unsupported-attribute"],"backgroundTag":"unrecognized-attribute","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}