{"record":{"id":"7a69a9dddbde6ef6","repo":"swc-project/swc","slug":"eofwithunclosedelements","errorCode":"EofWithUnclosedElements","errorMessage":"End of file seen and there were open elements","messagePattern":"End of file seen and there were open elements","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":2003,"sourceCode":"                                parser.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::NonSpaceCharacterInNoscriptInHead,\n                                ));\n                            }\n                            Token::StartTag { tag_name, .. } => {\n                                parser.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::BadStartTagInNoscriptInHead(tag_name.clone()),\n                                ));\n                            }\n                            Token::EndTag { tag_name, .. } => {\n                                parser.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::StrayEndTag(tag_name.clone()),\n                                ));\n                            }\n                            Token::Eof => {\n                                parser.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::EofWithUnclosedElements,\n                                ));\n                            }\n                            _ => {\n                                unreachable!()\n                            }\n                        }\n\n                        parser.open_elements_stack.pop();\n                        parser.insertion_mode = InsertionMode::InHead;\n                        parser.process_token(token_and_info, None)?;\n\n                        Ok(())\n                    };\n\n                // When the user agent is to apply the rules for the \"in head noscript\"\n                // insertion mode, the user agent must handle the token as follows:","sourceCodeStart":1985,"sourceCodeEnd":2021,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L1985-L2021","documentation":"HTML parse error emitted when an EOF token is processed while the stack of open elements is not empty, i.e. the document ended with unclosed elements. The tree builder still pops/generates implied end tags so parsing recovers and yields a complete document tree.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:2003 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close all open elements before end of file (balance every start tag)","Verify no truncation of the input 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"}