Skip to content

🐛 Panic in useNamingConvention with biome check --write (builder.rs:217) #7798

@willgriffin

Description

@willgriffin

Biome Bug Report: Crash in useNamingConvention with biome check --write

Bug Description

Biome v2.2.6 crashes with an internal panic when running biome check --write on files that have useNamingConvention violations. The crash occurs specifically in the semantic model builder.

Error Details

Source Location: /Users/runner/work/biome/biome/crates/biome_js_semantic/src/semantic_model/builder.rs:217:56
Thread Name: biome::workspace_worker_0
Message: no entry found for key

packages/spider/src/adapters/dom.ts internalError/panic  INTERNAL
  × processing panicked: no entry found for key

Steps to Reproduce

1. Configuration

biome.json:

{
  "$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
  "linter": {
    "enabled": true,
    "rules": {
      "style": {
        "useNamingConvention": {
          "level": "warn",
          "options": {
            "strictCase": false,
            "conventions": [
              {
                "selector": { "kind": "variable" },
                "formats": ["camelCase", "CONSTANT_CASE", "PascalCase"]
              }
            ]
          }
        }
      }
    }
  }
}

2. Sample File with Violations

The crash occurs on files using cheerio with $ variables (which violate useNamingConvention):

import * as cheerio from 'cheerio';

export class DomAdapter {
  private extractLinks(html: string) {
    const $ = cheerio.load(html);  // Violates useNamingConvention
    const links = [];

    $('a').each((_, element) => {
      const $link = $(element);    // Violates useNamingConvention
      links.push($link.attr('href'));
    });

    return links;
  }
}

3. Trigger the Crash

biome check --write path/to/file.ts

Expected Behavior

Biome should either:

  1. Apply the auto-fix for useNamingConvention violations, OR
  2. Report that violations cannot be auto-fixed

Actual Behavior

Biome crashes with an internal panic in semantic_model/builder.rs:217:56

What Works

  • biome lint (read-only mode)
  • biome check (read-only mode)
  • biome check --write --linter-enabled=false (formatter + organizeImports only)
  • biome check --write --formatter-enabled=false --assist-enabled=false (linter only, but still crashes with useNamingConvention)
  • biome check --write with useNamingConvention: "off"

What Crashes

  • biome check --write with useNamingConvention enabled
  • biome check --write --formatter-enabled=false --assist-enabled=false (linter-only mode with useNamingConvention)

Root Cause Analysis

Through systematic testing, we isolated that:

  1. The crash is NOT in the formatter
  2. The crash is NOT in the assist/organizeImports
  3. The crash IS in the linter's semantic model builder
  4. The crash is specifically triggered by the useNamingConvention rule when running with --write

The linter can detect violations in read-only mode without crashing, but crashes when attempting to write fixes.

Environment

  • Biome version: 2.2.6
  • OS: macOS (Darwin 24.6.0)
  • Node version: 24.x
  • Package manager: pnpm

Workaround

Disable useNamingConvention for affected files via biome.json overrides:

{
  "overrides": [
    {
      "includes": ["packages/spider/src/**/*.ts"],
      "linter": {
        "rules": {
          "style": {
            "useNamingConvention": "off"
          }
        }
      }
    }
  ]
}

Additional Context

This appears to be a different bug from previously reported semantic model issues:

This is the first report of a crash at builder.rs:217:56 with the useNamingConvention rule.

Minimal Reproduction Repository

Available on request - the issue reproduces consistently with the configuration and sample code above.

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions