{"record":{"id":"c2b1c4f795aad68a","repo":"swc-project/swc","slug":"unexpectedeofinmainphase","errorCode":"UnexpectedEofInMainPhase","errorMessage":"Unexpected end of file in main phase","messagePattern":"Unexpected end of file in main phase","errorType":"validation","errorClass":"swc_xml_parser::error::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_xml_parser/src/parser/mod.rs","lineNumber":365,"sourceCode":"                    }\n                }\n                Token::Comment { .. } => {\n                    let comment = self.create_comment(token_and_info);\n\n                    self.append_node(self.get_current_element(), comment);\n                }\n                Token::ProcessingInstruction { .. } => {\n                    let processing_instruction = self.create_processing_instruction(token_and_info);\n\n                    self.append_node(self.get_current_element(), processing_instruction);\n                }\n                Token::Cdata { .. } => {\n                    let cdata = self.create_cdata_section(token_and_info);\n\n                    self.append_node(self.get_current_element(), cdata);\n                }\n                Token::Eof => {\n                    self.errors.push(Error::new(\n                        token_and_info.span,\n                        ErrorKind::UnexpectedEofInMainPhase,\n                    ));\n\n                    self.process_token(token_and_info, Some(Phase::EndPhase))?;\n                }\n                _ => {\n                    self.errors.push(Error::new(\n                        token_and_info.span,\n                        ErrorKind::UnexpectedTokenInMainPhase,\n                    ));\n                }\n            },\n            Phase::EndPhase => match &token_and_info.token {\n                Token::Comment { .. } => {\n                    self.append_comment_to_doc(token_and_info)?;\n                }\n                Token::ProcessingInstruction { .. } => {","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_xml_parser/src/parser/mod.rs#L347-L383","documentation":"Fired in the XML parser's main phase (process_token): the token stream ended (EOF) while the parser still expected markup — this signals truncated or unterminated XML input, e.g. a document ending inside an open element or before the required structure is complete. It is a sentinel guard against running out of tokens mid-parse.","triggerScenarios":"Thrown at crates/swc_xml_parser/src/parser/mod.rs:365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close all open elements before end of input","Verify the document was not truncated"],"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"}