Skip to content

HTML parser crash: HTML_BOGUS cast failure on '<' character in text content #8363

@aledlie

Description

@aledlie

Environment

  • Biome version: 2.3.8
  • Node.js version: v25.2.1
  • OS: macOS Darwin 25.1.0 (darwin-arm64)

Description

When running biome check on HTML files, Biome crashes with an internal error when it encounters a < character followed by a number in text content (e.g., <12 months).

While Biome correctly identifies this as a parse error (it expects < to start a tag), the internal handling causes a thread panic with HTML_BOGUS cast failure.

Error Message

Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue.

Source Location: /Users/runner/work/biome/biome/crates/biome_rowan/src/ast/mod.rs:206:13
Thread Name: biome::workspace_worker_0
Message: Tried to cast node with kind HTML_BOGUS as "biome_html_syntax::generated::nodes::HtmlRoot" but was unable to cast

Minimal Reproduction

Create a file test.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test</title>
</head>
<body>
    <div>Target <12 months</div>
</body>
</html>

Run:

npx @biomejs/biome check test.html

The parse error is expected (Biome interprets <12 as an invalid tag start), but the crash with HTML_BOGUS cast failure should not occur.

Expected Behavior

Biome should report the parse error gracefully without crashing. The error message for the parse issue is fine:

test.html:7:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━

  × Expected an attribute but instead found '<'.

  > 7 │     <div>Target <12 months</div>
      │                 ^

But after reporting this, it should continue processing without the internal HTML_BOGUS cast failure.

Additional Context

  • The error occurred multiple times (4 times in my case) when running on a directory with multiple HTML files containing similar patterns
  • No biome.json configuration file was present (default settings)
  • The < followed by a number pattern (like <12) is common in content discussing metrics, comparisons, or mathematical expressions

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ParserArea: parserL-HTMLLanguage: HTML and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bugworkaround

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions