swc-project/swc · error · Error
Start tag "{tag_name}" seen in "table" body
Error message
Start tag "{tag_name}" seen in "table" body What it means
HTML parse error in the 'in table body' insertion mode: a start tag other than the expected tr/th/td/caption/col/tbody-family was seen while parsing a table body (e.g. a cell or row tag in the wrong position). The tag name is included; recovery clears back to table body context and continues.
Source
Thrown at crates/swc_html_parser/src/parser/mod.rs:5241
..
} if tag_name == "tr" => {
self.open_elements_stack.clear_back_to_table_body_context();
self.insert_html_element(token_and_info)?;
self.insertion_mode = InsertionMode::InRow;
maybe_allow_self_closing!(is_self_closing, tag_name);
}
// A start tag whose tag name is one of: "th", "td"
//
// Parse error.
//
// Clear the stack back to a table body context. (See below.)
//
// Insert an HTML element for a "tr" start tag token with no attributes, then
// switch the insertion mode to "in row".
//
// Reprocess the current token.
Token::StartTag { tag_name, .. } if matches!(&**tag_name, "th" | "td") => {
self.errors.push(Error::new(
token_and_info.span,
ErrorKind::StartTagInTableBody(tag_name.clone()),
));
self.open_elements_stack.clear_back_to_table_body_context();
self.insert_html_element(&self.create_fake_token_and_info("tr", None))?;
self.insertion_mode = InsertionMode::InRow;
self.process_token(token_and_info, None)?;
}
// An end tag whose tag name is one of: "tbody", "tfoot", "thead"
//
// If the stack of open elements does not have an element in table scope that is
// an HTML element with the same tag name as the token, this is a parse error;
// ignore the token.
//
// Otherwise:
//
// Clear the stack back to a table body context. (See below.)
//View on GitHub (pinned to 5176682b65)
Solutions
- Wrap cells in <tr> rows inside <tbody>/<thead>/<tfoot>
- Move the tag to a valid position in the table structure
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/swc_html_parser/src/parser/mod.rs:5241 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/64a70a4c28d1aa09.
Report an issue: GitHub.