{"record":{"id":"e4812c0265b124ac","repo":"swc-project/swc","slug":"end-tag-tag-name-seen-but-there-were-open-ele","errorCode":null,"errorMessage":"End tag \"{tag_name}\" seen, but there were open elements","messagePattern":"End tag \"(.+?)\" seen, but there were open elements","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":3361,"sourceCode":"                    // Generate implied end tags, except for li elements.\n                    //\n                    // If the current node is not an li element, then this is a parse error.\n                    //\n                    // Pop elements from the stack of open elements until an li element has been\n                    // popped from the stack.\n                    Token::EndTag { tag_name, .. } if tag_name == \"li\" => {\n                        if !self.open_elements_stack.has_in_list_item_scope(\"li\") {\n                            self.errors.push(Error::new(\n                                token_and_info.span,\n                                ErrorKind::NoElementToCloseButEndTagSeen(tag_name.clone()),\n                            ));\n                        } else {\n                            self.open_elements_stack\n                                .generate_implied_end_tags_with_exclusion(\"li\");\n\n                            match self.open_elements_stack.items.last() {\n                                Some(node) if !is_html_element!(node, \"li\") => {\n                                    self.errors.push(Error::new(\n                                        token_and_info.span,\n                                        ErrorKind::UnclosedElements(tag_name.clone()),\n                                    ));\n                                }\n                                _ => {}\n                            }\n\n                            let popped =\n                                self.open_elements_stack.pop_until_tag_name_popped(&[\"li\"]);\n\n                            self.update_end_tag_span(popped.as_ref(), token_and_info.span);\n                        }\n                    }\n                    // An end tag whose tag name is one of: \"dd\", \"dt\"\n                    //\n                    // If the stack of open elements does not have an element in scope that is an\n                    // HTML element with the same tag name as that of the token, then this is a\n                    // parse error; ignore the token.","sourceCodeStart":3343,"sourceCodeEnd":3379,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L3343-L3379","documentation":"HTML parse error on an </li> end tag: 'li' is not in list item scope, or after generating implied end tags the current node was not an li, meaning the </li> closes through other still-open elements. The parser pops until an li is popped and records this error.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:3361 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Match each </li> with a proper <li> start tag","Close intervening elements so lists are correctly nested"],"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"}