{"record":{"id":"688a4975bc2e465a","repo":"vectordotdev/vector","slug":"required-one-of-cannot-be-applied-to-a-serde-688a49","errorCode":null,"errorMessage":"`required_one_of` cannot be applied to a `#[serde(skip_deserializing)]` field; users cannot set its value","messagePattern":"`required_one_of` cannot be applied to a `#\\[serde\\(skip_deserializing\\)\\]` field; users cannot set its value","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"lib/vector-config-macros/src/configurable.rs","lineNumber":394,"sourceCode":"            if field.flatten() {\n                return syn::Error::new(\n                    field.span(),\n                    \"`required_one_of` cannot be applied to a `#[serde(flatten)]` field\",\n                )\n                .to_compile_error();\n            }\n            if !is_option_type(field.ty())\n                && field.default_value().is_none()\n                && container.default_value().is_none()\n            {\n                return syn::Error::new(\n                    field.span(),\n                    \"`required_one_of` requires the field to be optional; use `Option<T>` or add `#[serde(default)]`\",\n                )\n                .to_compile_error();\n            }\n            if field.skip_deserializing() {\n                return syn::Error::new(\n                    field.span(),\n                    \"`required_one_of` cannot be applied to a `#[serde(skip_deserializing)]` field; users cannot set its value\",\n                )\n                .to_compile_error();\n            }\n        }\n    }\n\n    // Collect required_one_of groups at macro-expansion time: group_name -> [serde field names].\n    let mut groups: std::collections::BTreeMap<String, Vec<String>> =\n        std::collections::BTreeMap::new();\n    for field in fields.iter().filter(|f| f.visible()) {\n        if let Some(group) = field.required_one_of() {\n            groups\n                .entry(group.to_string())\n                .or_default()\n                .push(field.name().to_string());\n        }","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-config-macros/src/configurable.rs#L376-L412","documentation":"Compile-time error from `build_named_struct_generate_schema_fn`. `#[serde(skip_deserializing)]` means the field's value is never taken from user config (it is populated by code after deserialization), so users cannot satisfy a `required_one_of` group through it. The macro rejects this combination explicitly.","triggerScenarios":"A field annotated with both `#[serde(skip_deserializing)]` (e.g. computed/derived fields like a client handle or resolved endpoint) and `#[configurable(required_one_of(...))]`.","commonSituations":"Config structs that carry runtime-resolved state alongside user options; during a schema-attributes refactor the group attribute is left on the now-internal field.","solutions":["Remove `required_one_of` from the skip_deserializing field","Redesign the group so it only contains fields users can actually set in config","If the field is user-settable after all, remove `#[serde(skip_deserializing)]` and make it optional"],"exampleFix":"// before\n#[configurable(required_one_of = [\"auth\"])]\n#[serde(skip_deserializing)]\npub auth: AuthState,\n\n// after\n#[serde(skip_deserializing)]\npub auth: AuthState, // excluded from the group; group uses user-set fields","handlingStrategy":"validation","validationCode":"# CI gate: skip_deserializing conflicts fail at compile time\ncargo check --workspace --all-targets","typeGuard":null,"tryCatchPattern":null,"preventionTips":["required_one_of only makes sense on fields users can set in config","Keep internal/skip_deserializing fields out of schema constraint groups"],"tags":["rust","proc-macro","compile-time","serde","schema-validation","vector"],"backgroundTag":"macro-attribute-conflict","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}