{"record":{"id":"cd43f994c52ff108","repo":"bevyengine/bevy","slug":"invalid-key-override-attribute","errorCode":null,"errorMessage":"Invalid key override attribute","messagePattern":"Invalid key override attribute","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_render/macros/src/specializer.rs","lineNumber":151,"sourceCode":"            Member::Unnamed(Index {\n                index: index as u32,\n                span: field.span(),\n            }),\n            Member::Named,\n        );\n        let key_index = Index {\n            index: used_count,\n            span: field.span(),\n        };\n\n        let mut use_key_field = true;\n        let mut key = Key::Index(key_index);\n        for attr in &field.attrs {\n            match &attr.meta {\n                Meta::List(MetaList { path, tokens, .. }) if path.is_ident(&KEY_ATTR_IDENT) => {\n                    let owned_tokens = tokens.clone().into();\n                    let Ok(parsed_key) = syn::parse::<Key>(owned_tokens) else {\n                        return Err(syn::Error::new(\n                            attr.span(),\n                            \"Invalid key override attribute\",\n                        ));\n                    };\n                    key = parsed_key;\n                    if matches!(\n                        (&key, &targets),\n                        (Key::Custom(_), SpecializeImplTargets::All)\n                    ) {\n                        return Err(syn::Error::new(\n                            attr.span(),\n                            \"#[key(default)] is the only key override type allowed with #[specialize(all)]\",\n                        ));\n                    }\n                    use_key_field = false;\n                }\n                _ => {}\n            }","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_render/macros/src/specializer.rs#L133-L169","documentation":"The same `#[key(...)]` machinery as the previous error, but this message comes from the attribute-processing site in the specializer macro: when `syn::parse::<Key>` cannot parse the raw attribute tokens at all, the derive emits \"Invalid key override attribute\" pointing at the whole `#[key(...)]` attribute.","triggerScenarios":"Token sequences inside `#[key(...)]` that are neither a single identifier nor a single expression, e.g. `#[key(default default)]`, `#[key(,)]`, or two comma-separated payloads merged into one attribute.","commonSituations":"Copy-pasting two key overrides into one attribute during refactor; merge artifacts leaving duplicated payloads; leftover commas.","solutions":["Put exactly one payload in `#[key(...)]`: either `default` or a single expression","Keep one `#[key]` attribute per field; never combine payloads","Compare against a known-good Specializer/SpecializerKey usage and mirror the shape"],"exampleFix":"// before\n#[key(default, MyKey::A)]\nmode: Mode,\n\n// after\n#[key(MyKey::A)]\nmode: Mode,","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["One payload per #[key(...)] attribute: either `default` or one expression","Avoid merging attributes during copy-paste refactors","Let rustfmt/syn-compatible tooling touch the attribute bodies, not hand-edits mid-thought"],"tags":["bevy","specializer","proc-macro","compile-time"],"backgroundTag":"invalid-macro-attribute-value","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}