{"record":{"id":"04e7adf8584a5dca","repo":"denoland/deno","slug":"cannot-combine-untagged-with-tag-or-content","errorCode":null,"errorMessage":"Cannot combine `untagged` with `tag` or `content`","messagePattern":"Cannot combine `untagged` with `tag` or `content`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"libs/ops/conversion/to_v8/enum.rs","lineNumber":264,"sourceCode":"        let args = list.parse_args_with(\n          Punctuated::<EnumModeArgument, Token![,]>::parse_terminated,\n        )?;\n\n        for arg in args {\n          match arg {\n            EnumModeArgument::Tag { value, .. } => tag = Some(value.value()),\n            EnumModeArgument::Content { value, .. } => {\n              content = Some(value.value())\n            }\n            EnumModeArgument::Untagged { .. } => untagged = true,\n          }\n        }\n      }\n    }\n\n    if untagged {\n      if tag.is_some() || content.is_some() {\n        return Err(Error::new(\n          Span::call_site(),\n          \"Cannot combine `untagged` with `tag` or `content`\",\n        ));\n      }\n      return Ok(EnumMode::Untagged);\n    }\n\n    match (tag, content) {\n      (None, None) => Ok(EnumMode::ExternallyTagged),\n      (Some(tag), None) => Ok(EnumMode::InternallyTagged {\n        tag: crate::get_internalized_string(Ident::new(&tag, span))?,\n      }),\n      (Some(tag), Some(content)) => Ok(EnumMode::AdjacentlyTagged {\n        tag: crate::get_internalized_string(Ident::new(&tag, span))?,\n        content: crate::get_internalized_string(Ident::new(&content, span))?,\n      }),\n      (None, Some(_)) => Err(Error::new(\n        Span::call_site(),","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/ops/conversion/to_v8/enum.rs#L246-L282","documentation":"#[derive(ToV8)] supports several tagging modes set at the container level: #[to_v8(tag = \"...\")] (internally tagged), adding #[to_v8(content = \"...\")] (adjacently tagged), and #[to_v8(untagged)]. When untagged is combined with tag or content, the modes contradict (untagged emits no tag at all), so parse_enum_mode returns this compile error at the call site.","triggerScenarios":"Writing #[to_v8(untagged, tag = \"kind\")] or #[to_v8(untagged, content = \"data\")] on an enum derived with ToV8.","commonSituations":"Migrating a serde enum that used both untagged and tag-like attributes; merging attributes from two examples; editing a tagged enum to untagged and forgetting to delete the old tag/content arguments.","solutions":["Decide the mode: keep #[to_v8(untagged)] alone, or remove untagged and keep tag (optionally with content).","If you need per-variant control, use rename/serde attributes on variants instead of mixing container modes."],"exampleFix":"// before\n#[derive(ToV8)]\n#[to_v8(untagged, tag = \"kind\")] // error: Cannot combine `untagged` with `tag` or `content`\nenum Value {\n  Num(u32),\n  Str(String),\n}\n\n// after\n#[derive(ToV8)]\n#[to_v8(untagged)]\nenum Value {\n  Num(u32),\n  Str(String),\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick exactly one tagging mode per enum: default (externally tagged), tag (internally), tag+content (adjacently), or untagged — never combinations.","When migrating a serde enum, translate its tagging attributes one-to-one instead of stacking all of them."],"tags":["proc-macro","derive","to-v8","enum","attribute-conflict","compile-time","deno-core"],"backgroundTag":"conflicting-attributes","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}