{"record":{"id":"3a2215ae0db678a7","repo":"astral-sh/ruff","slug":"can-only-derive-configurationoptions-from-structs","errorCode":null,"errorMessage":"Can only derive ConfigurationOptions from structs with named fields.","messagePattern":"Can only derive ConfigurationOptions from structs with named fields\\.","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_macros/src/config.rs","lineNumber":98,"sourceCode":"                Some(quote!(\n                    fn documentation() -> Option<&'static str> {\n                        Some(&#doc)\n                    }\n                ))\n            };\n\n            Ok(quote! {\n                #[automatically_derived]\n                impl ruff_options_metadata::OptionsMetadata for #ident {\n                    fn record(visit: &mut dyn ruff_options_metadata::Visit) {\n                        #(#output);*\n                    }\n\n                    #documentation\n                }\n            })\n        }\n        _ => Err(syn::Error::new(\n            ident.span(),\n            \"Can only derive ConfigurationOptions from structs with named fields.\",\n        )),\n    }\n}\n\n/// For a field with type `Option<Foobar>` where `Foobar` itself is a struct\n/// deriving `ConfigurationOptions`, create code that calls retrieves options\n/// from that group: `Foobar::get_available_options()`\nfn handle_option_group(field: &Field) -> syn::Result<proc_macro2::TokenStream> {\n    let ident = field\n        .ident\n        .as_ref()\n        .expect(\"Expected to handle named fields\");\n\n    match &field.ty {\n        Type::Path(TypePath {\n            path: Path { segments, .. },","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_macros/src/config.rs#L80-L116","documentation":"A syn compile error from the ConfigurationOptions derive macro: the annotated type is not a struct with named fields. The macro walks named fields to emit OptionsMetadata visiting code, so other shapes are rejected at compile time.","triggerScenarios":"Thrown at crates/ruff_macros/src/config.rs:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restructure the options type as a named-field struct","Implement OptionsMetadata manually for this type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}