{"record":{"id":"17bc18123338ce8c","repo":"vectordotdev/vector","slug":"enums-must-always-have-a-tagging-mode","errorCode":null,"errorMessage":"enums must always have a tagging mode","messagePattern":"enums must always have a tagging mode","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/vector-config-macros/src/configurable.rs","lineNumber":190,"sourceCode":"        }\n    };\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::vec::Vec::new();\n            let mut discriminant_map = ::std::collections::HashMap::new();\n\n            #(#mapped_variants)*\n\n            #generate_block\n        }\n    }\n}\n\nfn is_enum_schema_potentially_ambiguous(container: &Container, variants: &[Variant]) -> bool {\n    let tagging = container\n        .tagging()\n        .expect(\"enums must always have a tagging mode\");\n    match tagging {\n        Tagging::None => {\n            // Named variants are distinguished by required fields, while scalar and newtype\n            // variants are distinguished by their generated schemas. `EnumDiscriminant` handles\n            // both forms, so every multi-variant untagged enum can be checked for overlap.\n            variants.len() >= 2\n        }\n        _ => {\n            // Tagged enums can contain trailing `#[serde(untagged)]` variants. If there are\n            // multiple such variants, collect their discriminants so overlapping fallbacks use\n            // `anyOf`.\n            variants\n                .iter()\n                .filter(|variant| variant.tagging() == &Tagging::None)\n                .count()\n                >= 2\n        }\n    }","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/vector-config-macros/src/configurable.rs#L172-L208","documentation":"In the vector-config derive machinery, `is_enum_schema_potentially_ambiguous` unwraps `container.tagging()` with an expect. serde guarantees every enum container has a tagging mode (internal/adjacent/untagged/externally tagged), so None means the derive saw a container it classified as an enum without tagging metadata — a break of the derive's own invariants.","triggerScenarios":"Running the `#[configurable]` derive on an enum when `build_enum_generate_schema_fn` inspects the container and `tagging()` returns None — only possible if the container data is malformed or the derive's container classification changed.","commonSituations":"Unreachable for users; could surface with a version mismatch between vector-config and serde/serde_derive, or a proc-macro bug after upgrading toolchain versions.","solutions":["Ensure vector-config, vector-config-macros, and serde versions are consistent (update the workspace / cargo update)","Rebuild cleanly (cargo clean) to rule out stale proc-macro artifacts","If reproducible on a fresh build, file an issue with the enum definition and dependency versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep vector-config and serde versions aligned","cargo clean when proc-macro errors appear after upgrades","Report reproducible derive panics with the enum definition"],"tags":["proc-macro","serde","schema","panic","internal-invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}