{"record":{"id":"d4780d005be92c10","repo":"astral-sh/ruff","slug":"expected-option-as-type","errorCode":null,"errorMessage":"Expected `Option<_>`  as type.","messagePattern":"Expected `Option<_>`  as type\\.","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_macros/src/config.rs","lineNumber":131,"sourceCode":"\n    match &field.ty {\n        Type::Path(TypePath {\n            path: Path { segments, .. },\n            ..\n        }) => match segments.first() {\n            Some(PathSegment {\n                ident: type_ident,\n                arguments:\n                    PathArguments::AngleBracketed(AngleBracketedGenericArguments { args, .. }),\n            }) if type_ident == \"Option\" => {\n                let path = &args[0];\n                let kebab_name = LitStr::new(&ident.to_string().replace('_', \"-\"), ident.span());\n\n                Ok(quote_spanned!(\n                    ident.span() => (visit.record_set(#kebab_name, ruff_options_metadata::OptionSet::of::<#path>()))\n                ))\n            }\n            _ => Err(syn::Error::new(\n                ident.span(),\n                \"Expected `Option<_>`  as type.\",\n            )),\n        },\n        _ => Err(syn::Error::new(ident.span(), \"Expected type.\")),\n    }\n}\n\n/// Parse a `doc` attribute into it a string literal.\nfn parse_doc(doc: &Attribute) -> syn::Result<String> {\n    match &doc.meta {\n        syn::Meta::NameValue(syn::MetaNameValue {\n            value:\n                syn::Expr::Lit(ExprLit {\n                    lit: Lit::Str(lit_str),\n                    ..\n                }),\n            ..","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_macros/src/config.rs#L113-L149","documentation":"A syn compile error from the ConfigurationOptions derive when handling an option-group field: the field's type path is not Option<...>, which the macro requires so it can emit a record_set call with the group's inner type.","triggerScenarios":"Thrown at crates/ruff_macros/src/config.rs:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the option group in Option<_>","Annotate the field differently or exclude it from the derive"],"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"}