{"record":{"id":"ba59bb3b7a1f9d4a","repo":"swc-project/swc","slug":"endtagwithunclosedelements","errorCode":"EndTagWithUnclosedElements","errorMessage":"Unexpected end tag for \"body\", but there were unclosed elements","messagePattern":"Unexpected end tag for \"body\", but there were unclosed elements","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":2651,"sourceCode":"                                \"dd\" | \"dt\"\n                                    | \"li\"\n                                    | \"optgroup\"\n                                    | \"option\"\n                                    | \"p\"\n                                    | \"rb\"\n                                    | \"rp\"\n                                    | \"rt\"\n                                    | \"rtc\"\n                                    | \"tbody\"\n                                    | \"td\"\n                                    | \"tfoot\"\n                                    | \"th\"\n                                    | \"thead\"\n                                    | \"tr\"\n                                    | \"body\"\n                                    | \"html\"\n                            ) {\n                                self.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::EndTagWithUnclosedElements(atom!(\"body\")),\n                                ));\n\n                                break;\n                            }\n                        }\n\n                        self.insertion_mode = InsertionMode::AfterBody;\n                    }\n                    // An end tag whose tag name is \"html\"\n                    //\n                    // If the stack of open elements does not have a body element in scope, this is\n                    // a parse error; ignore the token.\n                    //\n                    // Otherwise, if there is a node in the stack of open elements that is not\n                    // either a dd element, a dt element, an li element, an optgroup element, an\n                    // option element, a p element, an rb element, an rp element, an rt element, an","sourceCodeStart":2633,"sourceCodeEnd":2669,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L2633-L2669","documentation":"HTML parse error: </body> was reached while elements opened inside body were still on the stack of open elements (other than the expected body/html). The parser records the error and proceeds with the standard </body> handling, closing remaining content.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:2651 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close all inner elements before </body>","Check for omitted end tags earlier in the document"],"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"}