{"record":{"id":"3db6fb6a0c4fb2aa","repo":"vectordotdev/vector","slug":"required-one-of-is-not-supported-on-tuple-struct","errorCode":null,"errorMessage":"`required_one_of` is not supported on tuple struct fields","messagePattern":"`required_one_of` is not supported on tuple struct fields","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"lib/vector-config-macros/src/configurable.rs","lineNumber":526,"sourceCode":"                // That's kind of useless, and ends up as noise in the schema, so if we didn't have\n                // any of our own unflattened properties, then steal the first flattened subschema\n                // and swap our main schema for it before flattening things overall.\n                if !had_unflatted_properties {\n                    schema = flattened_subschemas.remove(0);\n                }\n\n                ::vector_config::schema::convert_to_flattened_schema(&mut schema, flattened_subschemas);\n            }\n\n            Ok(schema)\n        }\n    }\n}\n\nfn build_tuple_struct_generate_schema_fn(fields: &[Field<'_>]) -> proc_macro2::TokenStream {\n    for field in fields.iter() {\n        if field.required_one_of().is_some() {\n            return syn::Error::new(\n                field.span(),\n                \"`required_one_of` is not supported on tuple struct fields\",\n            )\n            .to_compile_error();\n        }\n    }\n\n    let mapped_fields = fields\n        .iter()\n        // Don't map this field if it's marked to be skipped for both serialization and deserialization.\n        .filter(|field| field.visible())\n        .map(generate_tuple_struct_field);\n\n    quote! {\n        fn generate_schema(schema_gen: &::std::cell::RefCell<::vector_config::schema::SchemaGenerator>) -> std::result::Result<::vector_config::schema::SchemaObject, ::vector_config::GenerateError> {\n            let mut subschemas = ::std::collections::Vec::new();\n\n            #(#mapped_fields)*","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-config-macros/src/configurable.rs#L508-L544","documentation":"Compile-time error from `build_tuple_struct_generate_schema_fn` in vector-config-macros. Tuple structs serialize as arrays, not objects with named keys, so a `oneOf`-over-field-names requirement has no meaning there. Any `required_one_of` on a tuple struct field is rejected before schema generation.","triggerScenarios":"`#[derive(Configurable)]` on a tuple struct like `struct Config(A)` where the field (position 0) carries `#[configurable(required_one_of(...))]`.","commonSituations":"Moving an attribute block from a named struct to a tuple wrapper, or blanket-applying component attribute macros during a refactor.","solutions":["Convert the tuple struct to a named struct so fields have keys and required_one_of is expressible","Or delete the required_one_of attribute — it cannot be honored on tuple structs"],"exampleFix":"// before\nstruct Config(#[configurable(required_one_of = [\"a\"])] Inner);\n\n// after\nstruct Config {\n    #[configurable(required_one_of = [\"a\", \"b\"])]\n    inner: Option<Inner>,\n}","handlingStrategy":"validation","validationCode":"# CI gate: unsupported tuple-struct usage fails at compile time\ncargo check --workspace --all-targets","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use named structs when you need required_one_of constraints","Don't carry field attributes over when converting a struct to tuple form"],"tags":["rust","proc-macro","compile-time","tuple-struct","schema-validation","vector"],"backgroundTag":"macro-attribute-misplaced","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}