{"record":{"id":"d16d8918aef27deb","repo":"linebender/druid","slug":"duplicate-attribute","errorCode":null,"errorMessage":"Duplicate attribute","messagePattern":"Duplicate attribute","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"druid-derive/src/attr.rs","lineNumber":222,"sourceCode":"        let mut ignore = false;\n        let mut lens_name_override = None;\n\n        for attr in field.attrs.iter() {\n            if attr.path.is_ident(BASE_DRUID_DEPRECATED_ATTR_PATH) {\n                panic!(\n                    \"The 'druid' attribute has been replaced with separate \\\n                    'lens' and 'data' attributes.\",\n                );\n            } else if attr.path.is_ident(BASE_LENS_ATTR_PATH) {\n                match attr.parse_meta()? {\n                    Meta::List(meta) => {\n                        for nested in meta.nested.iter() {\n                            match nested {\n                                NestedMeta::Meta(Meta::Path(path))\n                                    if path.is_ident(IGNORE_ATTR_PATH) =>\n                                {\n                                    if ignore {\n                                        return Err(Error::new(\n                                            nested.span(),\n                                            \"Duplicate attribute\",\n                                        ));\n                                    }\n                                    ignore = true;\n                                }\n                                NestedMeta::Meta(Meta::NameValue(meta))\n                                    if meta.path.is_ident(LENS_NAME_OVERRIDE_ATTR_PATH) =>\n                                {\n                                    if lens_name_override.is_some() {\n                                        return Err(Error::new(meta.span(), \"Duplicate attribute\"));\n                                    }\n\n                                    let ident = parse_lit_into_ident(&meta.lit)?;\n                                    lens_name_override = Some(ident);\n                                }\n                                other => return Err(Error::new(other.span(), \"Unknown attribute\")),\n                            }","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-derive/src/attr.rs#L204-L240","documentation":"While parsing #[lens(...)] field attributes, the lens(ignore) option may appear at most once per item. Specifying lens(ignore) (or repeating the ignore path) twice triggers this compile-time error at the second occurrence's span.","triggerScenarios":"Writing #[lens(ignore, ignore)] on the same field, or repeating the ignore path in two different nested forms within one attribute list.","commonSituations":"Merging fields or copy-pasting attribute lines when refactoring struct definitions, resulting in a duplicated ignore directive.","solutions":["Remove the duplicate lens(ignore) — one occurrence is enough to exclude the field from the lens.","Review the field's attribute list and deduplicate options.","If you meant to ignore two different fields, put one #[lens(ignore)] on each field."],"exampleFix":"// before\n#[lens(ignore, ignore)]\nscreen: ScreenId,\n// after\n#[lens(ignore)]\nscreen: ScreenId,","handlingStrategy":"validation","validationCode":"// Deduplicate lens options before compiling:\nfn check_no_dup_ignore(attrs: &[&str]) -> Result<(), String> {\n    let count = attrs.iter().filter(|a| **a == \"ignore\").count();\n    if count > 1 { Err(\"lens(ignore) specified more than once\".into()) } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write lens(ignore) at most once per field.","After merge conflicts, re-read each field's attribute list for duplicates.","One ignore directive excludes the field fully; repetition adds nothing."],"tags":["derive-macro","proc-macro","compile-time","duplicate-attribute"],"backgroundTag":"conflicting-config-options","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"}