{"record":{"id":"b4e20c569764b11a","repo":"swc-project/swc","slug":"somethingbetweenheadandbody","errorCode":"SomethingBetweenHeadAndBody","errorMessage":"\"{tag_name}\" element between \"head\" and \"body\"","messagePattern":"\"(.+?)\" element between \"head\" and \"body\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":2225,"sourceCode":"                    //\n                    // Remove the node pointed to by the head element pointer from the stack of open\n                    // elements. (It might not be the current node at this point.)\n                    Token::StartTag { tag_name, .. }\n                        if matches!(\n                            &**tag_name,\n                            \"base\"\n                                | \"basefont\"\n                                | \"bgsound\"\n                                | \"link\"\n                                | \"meta\"\n                                | \"noframes\"\n                                | \"script\"\n                                | \"style\"\n                                | \"template\"\n                                | \"title\"\n                        ) =>\n                    {\n                        self.errors.push(Error::new(\n                            token_and_info.span,\n                            ErrorKind::SomethingBetweenHeadAndBody(tag_name.clone()),\n                        ));\n\n                        let head = self\n                            .head_element_pointer\n                            .as_ref()\n                            .expect(\"no head element\")\n                            .clone();\n\n                        self.open_elements_stack.push(head.clone());\n                        self.process_token_using_rules(token_and_info, InsertionMode::InHead)?;\n                        self.open_elements_stack.remove(&head);\n                    }\n                    // An end tag whose tag name is \"template\"\n                    //\n                    // Process the token using the rules for the \"in head\" insertion mode.\n                    Token::EndTag { tag_name, .. } if tag_name == \"template\" => {","sourceCodeStart":2207,"sourceCodeEnd":2243,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L2207-L2243","documentation":"HTML parse error in the 'after head' insertion mode: a start tag for a head-only element (base, basefont, bgsound, link, meta, noframes, script, style, template, title) appeared after </head> but before <body>. Per spec it is reprocessed using the 'in head' rules while the error is recorded.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:2225 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move the element inside <head>","Start the <body> before emitting body-level content"],"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"}