{"record":{"id":"dafe07942065ecde","repo":"swc-project/swc","slug":"unclosed-elements-on-stack","errorCode":null,"errorMessage":"Unclosed elements on stack","messagePattern":"Unclosed elements on stack","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":5000,"sourceCode":"                                | \"tbody\"\n                                | \"td\"\n                                | \"tfoot\"\n                                | \"th\"\n                                | \"thead\"\n                                | \"tr\"\n                        ) =>\n                    {\n                        if !self.open_elements_stack.has_in_table_scope(\"caption\") {\n                            self.errors.push(Error::new(\n                                token_and_info.span,\n                                ErrorKind::StrayStartTag(tag_name.clone()),\n                            ));\n                        } else {\n                            self.open_elements_stack.generate_implied_end_tags();\n\n                            match self.open_elements_stack.items.last() {\n                                Some(node) if !is_html_element!(node, \"caption\") => {\n                                    self.errors.push(Error::new(\n                                        token_and_info.span,\n                                        ErrorKind::UnclosedElementsOnStack,\n                                    ));\n                                }\n                                _ => {}\n                            }\n\n                            self.open_elements_stack\n                                .pop_until_tag_name_popped(&[\"caption\"]);\n                            self.active_formatting_elements.clear_to_last_marker();\n                            self.insertion_mode = InsertionMode::InTable;\n                            self.process_token(token_and_info, None)?;\n                        }\n                    }\n                    Token::EndTag { tag_name, .. } if tag_name == \"table\" => {\n                        if !self.open_elements_stack.has_in_table_scope(\"caption\") {\n                            self.errors.push(Error::new(\n                                token_and_info.span,","sourceCodeStart":4982,"sourceCodeEnd":5018,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L4982-L5018","documentation":"HTML parse error raised near EOF/table handling (StrayStartTag family path): when processing the token, elements remained unclosed on the stack of open elements where the spec expects them closed, e.g. a caption/table-related start tag seen with no matching scope. The error is recorded and the tree builder recovers by popping/generating implied end tags.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:5000 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close all table/caption elements with matching end tags","Ensure the table structure (table>caption>colgroup/thead/tbody>tr>td) is well formed"],"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"}