{"record":{"id":"be36028d5d6bd360","repo":"astral-sh/ruff","slug":"mandatory-value-type-field-is-missing-in-opti","errorCode":null,"errorMessage":"Mandatory `value_type` field is missing in `#[option]` attribute. Specify the value type using `#[option(value_type=\"..\")]`.","messagePattern":"Mandatory `value_type` field is missing in `#\\[option\\]` attribute\\. Specify the value type using `#\\[option\\(value_type=\"\\.\\.\"\\)\\]`\\.","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/ruff_macros/src/config.rs","lineNumber":281,"sourceCode":"                format!(\n                    \"Deprecated meta {:?} is not supported by ruff's option macro.\",\n                    meta.path.get_ident()\n                ),\n            ));\n        }\n\n        Ok(())\n    })?;\n\n    let Some(default) = default else {\n        return Err(syn::Error::new(\n            attribute.span(),\n            \"Mandatory `default` field is missing in `#[option]` attribute. Specify the default using `#[option(default=\\\"..\\\")]`.\",\n        ));\n    };\n\n    let Some(value_type) = value_type else {\n        return Err(syn::Error::new(\n            attribute.span(),\n            \"Mandatory `value_type` field is missing in `#[option]` attribute. Specify the value type using `#[option(value_type=\\\"..\\\")]`.\",\n        ));\n    };\n\n    let Some(example) = example else {\n        return Err(syn::Error::new(\n            attribute.span(),\n            \"Mandatory `example` field is missing in `#[option]` attribute. Add an example using `#[option(example=\\\"..\\\")]`.\",\n        ));\n    };\n\n    Ok(FieldAttributes {\n        default,\n        value_type,\n        example,\n        scope,\n    })","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ruff_macros/src/config.rs#L263-L299","documentation":"Compile-time error emitted by the #[option] derive/attribute macro in ruff_macros while parsing a struct field's attributes. Every field marked #[option] must declare its value type so configuration documentation and schema generation can describe it; when parse_field_attributes (invoked via handle_option) finishes scanning the attribute's meta items without having collected a value_type entry, it reports this error pointing at the attribute span. The macro user fixes it by adding value_type=\"..\" to the #[option(...)] attribute. Not a runtime error and not catchable — it aborts proc-macro expansion.","triggerScenarios":"Thrown at crates/ruff_macros/src/config.rs:281 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add #[option(value_type = \"...\")] describing the option's type","Check for typos in the key name"],"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"}