Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Biome encountered an unexpected error #2460

Closed
1 task done
wojtekmaj opened this issue Apr 15, 2024 · 4 comments · Fixed by #2520
Closed
1 task done

🐛 Biome encountered an unexpected error #2460

wojtekmaj opened this issue Apr 15, 2024 · 4 comments · Fixed by #2520
Assignees
Labels
A-Analyzer Area: analyzer L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@wojtekmaj
Copy link

wojtekmaj commented Apr 15, 2024

Environment information

CLI:
  Version:                      1.6.4
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.12.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "yarn/4.1.1"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

What happened?

npx @biomejs/biome lint . --apply-unsafe resulted with:

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:238:13
Thread Name: biome::worker_0
Message: Tried to cast node with kind JS_EXPRESSION_STATEMENT as `"biome_js_syntax::generated::nodes::AnyJsCallArgument"` but was unable to cast

npx @biomejs/biome lint . --apply does not crash, but appears to be running exceptionally low on this particular repository.

Expected result

Unsafe fixes to be applied.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@wojtekmaj wojtekmaj changed the title 🐛 <TITLE> 🐛 Biome encountered an unexpected error Apr 15, 2024
@wojtekmaj
Copy link
Author

wojtekmaj commented Apr 15, 2024

It might be related to #1144, but:

  • Source location line is different (238 and not 230),
  • I'm running the latest version od Biome, which is 1.6.4 at the time of writing.

@Sec-ant
Copy link
Member

Sec-ant commented Apr 15, 2024

Hi, can you help us track down which file triggers this error and provide the code?

Also, which rules have you enabled in your configuration?

@wojtekmaj
Copy link
Author

Sorry, I'm sort of a newbie in Biome, so that's all the info I got initially.

I tried to narrow down the issue and got a bit more info. Ended up with an example as simple as:

foo(<>{bar}</>);

Removal of any of the syntax included seems to make the issue go away. The following are NOT crashing:

(<>{bar}</>);

<>{bar}</>;

foo(<>{}</>);

foo(<></>);

Given that the only rule triggered with the above code is lint/complexity/noUselessFragments, that would be my suspect.

@Sec-ant
Copy link
Member

Sec-ant commented Apr 15, 2024

@wojtekmaj This is very helpful, thank you for your time! I think this is an analyzer bug in the code action of noUselessFragments.

@Sec-ant Sec-ant added L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug A-Analyzer Area: analyzer labels Apr 15, 2024
@ematipico ematipico self-assigned this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Analyzer Area: analyzer L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants