{"record":{"id":"87763c6a24180229","repo":"swc-project/swc","slug":"failed-to-parse-tag-attribute","errorCode":null,"errorMessage":"failed to parse #[tag] attribute","messagePattern":"failed to parse #\\[tag\\] attribute","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ast_node/src/enum_deserialize.rs","lineNumber":68,"sourceCode":"                    }\n                    _ => {\n                        unreachable!(\"#[ast_node] enum cannot contain named fields or unit variant\")\n                    }\n                };\n                let tags = variant\n                    .attrs\n                    .iter()\n                    .filter_map(|attr| -> Option<VariantAttr> {\n                        if !is_attr_name(attr, \"tag\") {\n                            return None;\n                        }\n                        let tokens = match &attr.meta {\n                            Meta::List(meta) => meta.tokens.clone(),\n                            _ => {\n                                panic!(\"#[tag] attribute must be in form of #[tag(..)]\")\n                            }\n                        };\n                        let tags = parse2(tokens).expect(\"failed to parse #[tag] attribute\");\n\n                        Some(tags)\n                    })\n                    .flat_map(|v| v.tags)\n                    .collect::<Punctuated<_, token::Comma>>();\n\n                assert!(\n                    !tags.is_empty(),\n                    \"All #[ast_node] enum variants have one or more tag\"\n                );\n\n                // TODO: Clean up this code\n                if tags.len() == 1\n                    && match tags.first() {\n                        Some(Lit::Str(s)) => &*s.value() == \"*\",\n                        _ => false,\n                    }\n                {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/ast_node/src/enum_deserialize.rs#L50-L86","documentation":"Compile-time panic in the ast_node enum-deserialize derive: a #[tag(...)] attribute on a variant could not be parsed into a VariantAttr (malformed token stream in the attribute meta), so derive expansion aborts with this expect.","triggerScenarios":"Thrown at crates/ast_node/src/enum_deserialize.rs:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write the #[tag] attribute in the exact form the derive expects (e.g. #[tag(\"Name\")])","Remove the malformed attribute"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}