{"record":{"id":"861f04463604c0a7","repo":"swc-project/swc","slug":"straystarttag","errorCode":"StrayStartTag","errorMessage":"Stray start tag \"{tag_name}\"","messagePattern":"Stray start tag \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":2260,"sourceCode":"                    // Process the token using the rules for the \"in head\" insertion mode.\n                    Token::EndTag { tag_name, .. } if tag_name == \"template\" => {\n                        self.process_token_using_rules(token_and_info, InsertionMode::InHead)?;\n                    }\n                    // An end tag whose tag name is one of: \"body\", \"html\", \"br\"\n                    //\n                    // Act as described in the \"anything else\" entry below.\n                    Token::EndTag { tag_name, .. }\n                        if matches!(&**tag_name, \"body\" | \"html\" | \"br\") =>\n                    {\n                        anything_else(self, token_and_info)?;\n                    }\n                    // A start tag whose tag name is \"head\"\n                    //\n                    // Any other end tag\n                    //\n                    // Parse error. Ignore the token.\n                    Token::StartTag { tag_name, .. } if tag_name == \"head\" => {\n                        self.errors.push(Error::new(\n                            token_and_info.span,\n                            ErrorKind::StrayStartTag(tag_name.clone()),\n                        ));\n                    }\n                    Token::EndTag { tag_name, .. } => {\n                        self.errors.push(Error::new(\n                            token_and_info.span,\n                            ErrorKind::StrayEndTag(tag_name.clone()),\n                        ));\n                    }\n                    // Anything else\n                    //\n                    // Insert an HTML element for a \"body\" start tag token with no attributes.\n                    //\n                    // Switch the insertion mode to \"in body\".\n                    //\n                    // Reprocess the current token.\n                    _ => {","sourceCodeStart":2242,"sourceCodeEnd":2278,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L2242-L2278","documentation":"HTML parse error: a start tag that belongs in <body> was encountered in a context where it is not allowed (e.g. while still in head or another insertion mode), making it a 'stray' start tag. The tag name is included; the parser records the error and continues with spec recovery rules.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:2260 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Place the element inside <body> where it is valid","Restructure the document so the tag appears in an appropriate insertion context"],"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-14T05:17:10.506Z"}