{"record":{"id":"e9bc86171a978820","repo":"denoland/deno","slug":"content-requires-tag-to-be-specified","errorCode":null,"errorMessage":"`content` requires `tag` to be specified","messagePattern":"`content` requires `tag` to be specified","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"libs/ops/conversion/to_v8/enum.rs","lineNumber":281,"sourceCode":"      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(),\n        \"`content` requires `tag` to be specified\",\n      )),\n    }\n  }\n}\n\n#[allow(dead_code, reason = \"unused properties\")]\nenum EnumModeArgument {\n  Tag {\n    name_token: shared_kw::tag,\n    eq_token: Token![=],\n    value: LitStr,\n  },\n  Content {\n    name_token: shared_kw::content,\n    eq_token: Token![=],\n    value: LitStr,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/ops/conversion/to_v8/enum.rs#L263-L299","documentation":"In ToV8's enum mode parser, the (tag, content) pair maps to: neither = externally tagged, tag only = internally tagged, tag+content = adjacently tagged, and content without tag is impossible (adjacent tagging needs a tag key to work), so it returns this compile error. The message points you at the missing half of the pair.","triggerScenarios":"Writing #[to_v8(content = \"data\")] on a #[derive(ToV8)] enum without also specifying #[to_v8(tag = \"...\")].","commonSituations":"Copying just the content argument from an adjacently-tagged serde/ToV8 example; renaming or deleting the tag argument during a refactor and missing that content depends on it.","solutions":["Add the tag argument: #[to_v8(tag = \"kind\", content = \"data\")] — content is only valid as the second half of adjacent tagging.","If you did not want a tag at all, remove the content argument to fall back to plain externally-tagged output."],"exampleFix":"// before\n#[derive(ToV8)]\n#[to_v8(content = \"data\")] // error: `content` requires `tag` to be specified\nenum Event {\n  Click { x: i32 },\n}\n\n// after\n#[derive(ToV8)]\n#[to_v8(tag = \"type\", content = \"data\")]\nenum Event {\n  Click { x: i32 },\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember content= is only valid together with tag=; copy adjacently-tagged examples as a pair.","Let the compiler guide you: fix the first enum-mode error before adding more container attributes."],"tags":["proc-macro","derive","to-v8","enum","missing-attribute","compile-time","deno-core"],"backgroundTag":"missing-required-attribute","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}