{"record":{"id":"123092cc4527931f","repo":"bevyengine/bevy","slug":"reflect-must-use-parentheses-and","errorCode":null,"errorMessage":"`#[reflect(\"...\")]` must use parentheses `(` and `)`","messagePattern":"`#\\[reflect\\(\"\\.\\.\\.\"\\)\\]` must use parentheses `\\(` and `\\)`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_reflect/derive/src/derive_data.rs","lineNumber":203,"sourceCode":"        input: &'a DeriveInput,\n        provenance: ReflectProvenance,\n    ) -> Result<Self, syn::Error> {\n        let mut container_attributes = ContainerAttributes::default();\n        // Should indicate whether `#[type_path = \"...\"]` was used.\n        let mut custom_path: Option<Path> = None;\n        // Should indicate whether `#[type_name = \"...\"]` was used.\n        let mut custom_type_name: Option<Ident> = None;\n\n        #[cfg(feature = \"reflect_documentation\")]\n        let mut doc = crate::documentation::Documentation::default();\n\n        for attribute in &input.attrs {\n            match &attribute.meta {\n                Meta::List(meta_list) if meta_list.path.is_ident(REFLECT_ATTRIBUTE_NAME) => {\n                    if let MacroDelimiter::Paren(_) = meta_list.delimiter {\n                        container_attributes.parse_meta_list(meta_list, provenance.trait_)?;\n                    } else {\n                        return Err(syn::Error::new(\n                            meta_list.delimiter.span().join(),\n                            format_args!(\n                                \"`#[{REFLECT_ATTRIBUTE_NAME}(\\\"...\\\")]` must use parentheses `(` and `)`\"\n                            ),\n                        ));\n                    }\n                }\n                Meta::NameValue(pair) if pair.path.is_ident(TYPE_PATH_ATTRIBUTE_NAME) => {\n                    let syn::Expr::Lit(syn::ExprLit {\n                        lit: syn::Lit::Str(lit),\n                        ..\n                    }) = &pair.value\n                    else {\n                        return Err(syn::Error::new(\n                            pair.span(),\n                            format_args!(\"`#[{TYPE_PATH_ATTRIBUTE_NAME} = \\\"...\\\"]` must be a string literal\"),\n                        ));\n                    };","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_reflect/derive/src/derive_data.rs#L185-L221","documentation":"The `#[reflect(...)]` attribute must be a parenthesized list. In `derive_data.rs` (crates/bevy_reflect/derive/src/derive_data.rs:190), a `Meta::List` named `reflect` is accepted only when its delimiter is `MacroDelimiter::Paren`; bracket or brace delimiters — `#[reflect[...]]` or `#[reflect{...}]` — produce the compile error \"`#[reflect(\\\"...\\\")]` must use parentheses `(` and `)`\" at the delimiter's span.","triggerScenarios":"Typos and macro-generated code that emit `#[reflect[\"Debug\"]]`, `#[reflect{Debug}]`, or any reflect list with `[...]`/`{...}` delimiters instead of `(...)`.","commonSituations":"Hand-writing attributes with mismatched brackets; declarative macro rules that template the delimiter; editors auto-closing the wrong bracket type.","solutions":["Rewrite the attribute with parentheses: `#[reflect(Debug, Default)]`","If a macro generates it, fix the rule to emit `( ... )`"],"exampleFix":"// before\n#[reflect[\"Debug\"]]\nstruct Foo;\n\n// after\n#[reflect(Debug)]\nstruct Foo;","handlingStrategy":"validation","validationCode":"null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write reflect options inside parentheses: #[reflect(...)]","When generating attributes from macros, emit the parentheses explicitly in the rule"],"tags":["bevy","reflect","derive-macro","attribute-syntax","compile-error"],"backgroundTag":"invalid-derive-attribute-syntax","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}