{"record":{"id":"2460ac1f6049bc02","repo":"linebender/druid","slug":"expected-attribute-list-the-form-data-one-two","errorCode":null,"errorMessage":"Expected attribute list (the form #[data(one, two)])","messagePattern":"Expected attribute list \\(the form #\\[data\\(one, two\\)\\]\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"druid-derive/src/attr.rs","lineNumber":165,"sourceCode":"                                    data_attr = DataAttr::Ignore;\n                                }\n                                NestedMeta::Meta(Meta::NameValue(meta))\n                                    if meta.path.is_ident(DATA_SAME_FN_ATTR_PATH) =>\n                                {\n                                    let path = parse_lit_into_expr_path(&meta.lit)?;\n                                    data_attr = DataAttr::SameFn(path);\n                                }\n                                NestedMeta::Meta(Meta::Path(path))\n                                    if path.is_ident(DATA_EQ_ATTR_PATH) =>\n                                {\n                                    data_attr = DataAttr::Eq;\n                                }\n                                other => return Err(Error::new(other.span(), \"Unknown attribute\")),\n                            }\n                        }\n                    }\n                    other => {\n                        return Err(Error::new(\n                            other.span(),\n                            \"Expected attribute list (the form #[data(one, two)])\",\n                        ));\n                    }\n                }\n            }\n        }\n        Ok(Field {\n            ident,\n            ty,\n            attrs: data_attr,\n        })\n    }\n\n    /// The tokens to be used as the function for 'same'.\n    pub fn same_fn_path_tokens(&self) -> TokenStream {\n        match &self.attrs {\n            DataAttr::SameFn(f) => quote!(#f),","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-derive/src/attr.rs#L147-L183","documentation":"druid-derive expects the helper attribute to be used as a meta list of the form #[data(one, two)] (a parenthesized list of nested attributes). If the attribute appears in some other form — a bare path like #[data], a name-value form like #[data = \"x\"], or a non-list meta — the parser rejects it with this message.","triggerScenarios":"Using #[data] without parentheses on a field/variant, using #[data = \"value\"] name-value syntax, or any Meta form other than a list when the parser calls parse_ast.","commonSituations":"Forgetting the parentheses after the helper attribute name, confusing the helper attribute with the derive name itself, migrating code from crates with different attribute syntax.","solutions":["Wrap the arguments in parentheses: #[data(eq)] or #[data(ignore)].","Remove the attribute entirely if no options are needed (an empty #[data] is not valid).","Check the derive macro docs for the exact list syntax required by your druid version."],"exampleFix":"// before\n#[data]\nfield: i32,\n// after\n#[data(eq)]\nfield: i32,","handlingStrategy":"validation","validationCode":"// Ensure the helper attribute is always a list before compiling:\nfn is_list_form(attr: &str) -> bool {\n    let start = attr.find('(');\n    let end = attr.rfind(')');\n    matches!((start, end), (Some(s), Some(e)) if e > s)\n}\n// assert!(is_list_form(\"#[data(eq)]\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write helper attributes with parentheses: #[data(...)], #[lens(...)].","Never use name-value syntax (attr = \"x\") for druid derive helpers.","A bare #[data] or #[lens] does nothing valid — remove it or add options."],"tags":["derive-macro","proc-macro","compile-time","syntax"],"backgroundTag":"invalid-argument-format","analyzedSha":"0f8b1195e4e073f9597f2865299c3d18f8e4005f","analyzedAt":"2026-09-10T14:27:34.582Z","contentChangedAt":"2026-09-10T14:27:34.582Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}