{"record":{"id":"53bfc76bc0444e61","repo":"swc-project/swc","slug":"unexpectednullcharacter","errorCode":"UnexpectedNullCharacter","errorMessage":"Unexpected null character","messagePattern":"Unexpected null character","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":2292,"sourceCode":"                    //\n                    // Switch the insertion mode to \"in body\".\n                    //\n                    // Reprocess the current token.\n                    _ => {\n                        anything_else(self, token_and_info)?;\n                    }\n                }\n            }\n            // The \"in body\" insertion mode\n            InsertionMode::InBody => {\n                // When the user agent is to apply the rules for the \"in body\" insertion mode,\n                // the user agent must handle the token as follows:\n                match token {\n                    // A character token that is U+0000 NULL\n                    //\n                    // Parse error. Ignore the token.\n                    Token::Character { value, .. } if *value == '\\x00' => self.errors.push(\n                        Error::new(token_and_info.span, ErrorKind::UnexpectedNullCharacter),\n                    ),\n                    // A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE\n                    // FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020\n                    // SPACE\n                    //\n                    // Reconstruct the active formatting elements, if any.\n                    //\n                    // Insert the token's character.\n                    Token::Character {\n                        value: '\\x09' | '\\x0A' | '\\x0C' | '\\x0D' | '\\x20',\n                        ..\n                    } => {\n                        self.reconstruct_active_formatting_elements()?;\n                        self.insert_character(token_and_info)?;\n                    }\n                    // Any other character token\n                    //\n                    // Reconstruct the active formatting elements, if any.","sourceCodeStart":2274,"sourceCodeEnd":2310,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L2274-L2310","documentation":"HTML parse error in the 'in body' insertion mode: a U+0000 NULL character token was found in the input. Per spec NULL characters in content are parse errors; the character is ignored (typically replaced by U+FFFD in text) and parsing continues.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:2292 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Strip NUL bytes from the input before parsing","Fix the producer of the document so it emits valid text without U+0000"],"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"}