{"record":{"id":"077d352e8b797760","repo":"linebender/druid","slug":"unknown-attribute","errorCode":null,"errorMessage":"Unknown attribute","messagePattern":"Unknown attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"druid-derive/src/attr.rs","lineNumber":160,"sourceCode":"                        if let Some(nested) = meta.nested.first() {\n                            match nested {\n                                NestedMeta::Meta(Meta::Path(path))\n                                    if path.is_ident(IGNORE_ATTR_PATH) =>\n                                {\n                                    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    }","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-derive/src/attr.rs#L142-L178","documentation":"This error comes from druid-derive's parsing of helper attributes (e.g. #[data(...)]) during derive macro expansion. The derive expects only recognized nested attributes inside the helper attribute list; any other attribute path, name-value pair, or literal is rejected with \"Unknown attribute\". It is a compile-time proc-macro error pointing at the offending token's span.","triggerScenarios":"Writing an unrecognized entry inside #[data(...)] or #[lens(...)], such as #[data(foo)] or a typo like #[data(eq)] (correct form is data(eq)), or passing a name-value item where only path attributes are accepted.","commonSituations":"Typos in attribute names, copy-pasting attributes from other derive crates (serde-style attributes), misremembering the helper attribute syntax after a version change in druid-derive.","solutions":["Replace the unknown attribute with one supported by the derive (for #[data]: data(eq); for #[lens]: lens(name = \"...\") or lens(ignore)).","Check the druid-derive documentation/version for the exact accepted attribute names — names changed between druid versions.","Remove the stray attribute if it was intended for another derive macro, and place it on the correct item.","If the attribute belongs to another derive on the same struct, ensure you are not putting it inside the wrong helper attribute list."],"exampleFix":"// before\n#[derive(Data)]\nenum Msg {\n    #[data(ignore)]\n    A(i32),\n}\n// after\n#[derive(Data)]\nenum Msg {\n    #[data(eq)]\n    A(i32),\n}","handlingStrategy":"validation","validationCode":"// Before expanding the derive, audit each helper attribute:\nconst DATA_ALLOWED: &[&str] = &[\"eq\"];\nfn validate_data_attr(meta: &str) -> Result<(), String> {\n    let inner = meta.strip_prefix(\"data(\")?.strip_suffix(')')?;\n    inner.split(',').map(str::trim).try_for_each(|opt| {\n        if DATA_ALLOWED.contains(&opt) { Ok(()) } else { Err(format!(\"unknown data option: {}\", opt)) }\n    })\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use documented options inside #[data(...)]: currently data(eq).","Do not put foreign attributes (serde, etc.) inside the druid helper attribute list.","Check the druid-derive source/docs for accepted attribute names when upgrading versions.","Let the compiler point you at the exact span in the error message."],"tags":["derive-macro","proc-macro","compile-time","rust"],"backgroundTag":"invalid-argument-value","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"}