{"record":{"id":"dbe4452786eaca30","repo":"pydantic/monty","slug":"missing-from-args-name-on-the-struct","errorCode":null,"errorMessage":"missing `#[from_args(name = \"...\")]` on the struct","messagePattern":"missing `#\\[from_args\\(name = \"\\.\\.\\.\"\\)\\]` on the struct","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/monty-macros/src/from_args.rs","lineNumber":832,"sourceCode":"                if bad_arg.is_some() {\n                    return Err(meta.error(\"`bad_arg` and `bad_arg_named` are mutually exclusive\"));\n                }\n                bad_arg = Some(BadArgStyle::Named);\n                Ok(())\n            } else if meta.path.is_ident(\"kwargs_not_supported_yet\") {\n                kwargs_not_supported_yet = true;\n                Ok(())\n            } else {\n                Err(meta.error(\n                    \"unknown struct attribute; expected `name = \\\"...\\\"`, `style = def|clinic|c|c_named|unpack`, \\\n                     `at_most_total`, `vectorcall`, `kwarg_error_name = \\\"...\\\"`, `bad_arg`, `bad_arg_named`, \\\n                     or `kwargs_not_supported_yet`\",\n                ))\n            }\n        })?;\n    }\n    let name = name.ok_or_else(|| {\n        syn::Error::new(\n            Span::call_site(),\n            \"missing `#[from_args(name = \\\"...\\\")]` on the struct\",\n        )\n    })?;\n    Ok(StructAttrs {\n        name,\n        style: style.unwrap_or(Style::Clinic),\n        at_most_total,\n        vectorcall,\n        kwarg_error_name,\n        bad_arg,\n        kwargs_not_supported_yet,\n    })\n}\n\n#[derive(Default)]\npub(crate) struct FieldAttrs {\n    pub(crate) kind: FieldKind,","sourceCodeStart":814,"sourceCodeEnd":850,"githubUrl":"https://github.com/pydantic/monty/blob/adc986b362e3961f407868cb118a99fe831b9e61/crates/monty-macros/src/from_args.rs#L814-L850","documentation":"A compile-time error from the `FromArgs` derive macro. Every struct deriving `FromArgs` must carry `#[from_args(name = \"...\")]` giving the Python-visible function name, used to build accurate argument-binding error messages. Without it the macro cannot proceed and reports the missing attribute at the call site.","triggerScenarios":"Deriving `FromArgs` on a struct that has a `#[from_args(...)]` attribute list but no `name = \"...\"` entry in it, or that has no `#[from_args]` attribute at all where one is required by the style.","commonSituations":"Copy-pasting a struct definition and trimming the attribute, adding the derive before writing the attribute, or renaming a function without updating the `name` value.","solutions":["Add `#[from_args(name = \"function_name\")]` with the Python function name the struct binds arguments for","If the attribute was accidentally deleted, restore it from a sibling arg struct","Verify the name string matches the builtin/method name so runtime arg errors read correctly"],"exampleFix":"// before\n#[derive(FromArgs)]\nstruct FArgs { x: i64 }\n\n// after\n#[derive(FromArgs)]\n#[from_args(name = \"f\")]\nstruct FArgs { x: i64 }","handlingStrategy":"validation","validationCode":"// Every FromArgs struct needs: #[from_args(name = \"...\")]\n// Check the attribute exists before compiling:\n// grep -L 'from_args(name' my_args.rs","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write the #[from_args(name = \"...\")] attribute in the same commit as the derive","Keep the name string identical to the Python builtin/method being bound","Copy a sibling arg struct as a template when creating new ones"],"tags":["rust","derive-macro","compile-time","missing-attribute"],"backgroundTag":"missing-required-config-field","analyzedSha":"adc986b362e3961f407868cb118a99fe831b9e61","analyzedAt":"2026-09-13T19:19:18.698Z","contentChangedAt":"2026-09-13T19:19:18.698Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}