{"record":{"id":"8ac85d840c3c41bb","repo":"pydantic/monty","slug":"unknown-style-other-expected-def-clinic-c-c-named-or-unpack","errorCode":null,"errorMessage":"unknown style `{other}`; expected `def`, `clinic`, `c`, `c_named`, or `unpack`","messagePattern":"unknown style `(.+?)`; expected `def`, `clinic`, `c`, `c_named`, or `unpack`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/monty-macros/src/from_args.rs","lineNumber":790,"sourceCode":"        }\n        attr.parse_nested_meta(|meta| {\n            if meta.path.is_ident(\"name\") {\n                let value: LitStr = meta.value()?.parse()?;\n                name = Some(value.value());\n                Ok(())\n            } else if meta.path.is_ident(\"style\") {\n                if style.is_some() {\n                    return Err(meta.error(\"duplicate `style` attribute\"));\n                }\n                let value: Ident = meta.value()?.parse()?;\n                style = Some(match value.to_string().as_str() {\n                    \"def\" => Style::Def,\n                    \"clinic\" => Style::Clinic,\n                    \"c\" => Style::C,\n                    \"c_named\" => Style::CNamed,\n                    \"unpack\" => Style::Unpack,\n                    other => {\n                        return Err(syn::Error::new(\n                            value.span(),\n                            format!(\"unknown style `{other}`; expected `def`, `clinic`, `c`, `c_named`, or `unpack`\"),\n                        ));\n                    }\n                });\n                Ok(())\n            } else if meta.path.is_ident(\"at_most_total\") {\n                at_most_total = true;\n                Ok(())\n            } else if meta.path.is_ident(\"vectorcall\") {\n                vectorcall = true;\n                Ok(())\n            } else if meta.path.is_ident(\"kwarg_error_name\") {\n                let value: LitStr = meta.value()?.parse()?;\n                kwarg_error_name = Some(value.value());\n                Ok(())\n            } else if meta.path.is_ident(\"bad_arg\") {\n                if bad_arg.is_some() {","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/pydantic/monty/blob/adc986b362e3961f407868cb118a99fe831b9e61/crates/monty-macros/src/from_args.rs#L772-L808","documentation":"A compile-time error from the `FromArgs` derive macro's struct-attribute parser. The `#[from_args(style = \"...\")]` attribute only accepts one of `def`, `clinic`, `c`, `c_named`, or `unpack`; any other string is rejected with this message naming the invalid value.","triggerScenarios":"Writing `#[from_args(style = \"method\")]`, `#[from_args(style = \"C\")]` (wrong case), a typo like `clinci`, or any other unrecognized style string on a struct deriving `FromArgs`.","commonSituations":"Guessing style names from CPython terminology, copying a style from a different macro family, or capitalization drift (`c` vs `C`).","solutions":["Use one of the exact style names: `def`, `clinic`, `c`, `c_named`, or `unpack`","Match the style to the CPython parser family of the target function (see crates/monty-macros/README.md for the family table)","If no style is needed, remove the attribute entirely and let the default apply"],"exampleFix":"// before\n#[derive(FromArgs)]\n#[from_args(name = \"f\", style = \"method\")]\nstruct FArgs { x: i64 }\n\n// after\n#[derive(FromArgs)]\n#[from_args(name = \"f\", style = \"def\")]\nstruct FArgs { x: i64 }","handlingStrategy":"validation","validationCode":"// Validate the style string before writing the attribute.\nconst STYLES: [&str; 5] = [\"def\", \"clinic\", \"c\", \"c_named\", \"unpack\"];\nfn is_valid_style(s: &str) -> bool { STYLES.contains(&s) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy style names from an existing derive usage, not from memory","Styles are lowercase snake_case: def, clinic, c, c_named, unpack","Consult crates/monty-macros/README.md for which style matches the CPython parser family"],"tags":["rust","derive-macro","compile-time","invalid-attribute"],"backgroundTag":"invalid-enum-value","analyzedSha":"adc986b362e3961f407868cb118a99fe831b9e61","analyzedAt":"2026-09-13T19:19:18.698Z","contentChangedAt":"2026-09-13T19:19:18.698Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}