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

🐛 Big pack of js/ts files that crashes biome #342

Open
1 task done
qarmin opened this issue Sep 20, 2023 · 14 comments
Open
1 task done

🐛 Big pack of js/ts files that crashes biome #342

qarmin opened this issue Sep 20, 2023 · 14 comments

Comments

@qarmin
Copy link

qarmin commented Sep 20, 2023

Environment information

CLI:
  Version:                      0.0.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0

Discovering running Biome servers...

What happened?

Copy of issue rome/tools#4323

I still see multiple crashes(even in playground) when linting files(probably mostly invalid)

biome lint file.js

cause this crashes

Message: assertion failed: start <= end
  × processing panicked: begin <= end (1 <= 0) when slicing `/---`
Message: byte index 1 is not a char boundary; it is inside 'Ð' (bytes 0..2) of `Ð    expo`
Message: byte index 1 is out of bounds of ``

Files - https://github.com/rome/tools/files/12458119/Broken.zip

Screenshot from 2023-09-20 09-29-53

Expected result

No crashes

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos
Copy link
Member

Conaclos commented Jun 7, 2024

The reported error is now fixed. However, some files produce other internal errors.
I opened #3120.

@qarmin
Copy link
Author

qarmin commented Jun 30, 2024

Problematic files 30.06.2024 - Broken.zip

internal error: entered unreachable code
begin <= end (1 <= 0) when slicing `"`
The parser is no longer progressing. Stuck at ']' R_BRACK:10..11
internal error: entered unreachable code: Missing switch clause.
Expected a declaration as guaranteed by is_at_ts_declare_statement

crash locations

crates/biome_js_syntax/src/static_value.rs:66:33
crates/biome_parser/src/lib.rs:535:9
crates/biome_js_parser/src/syntax/typescript/statement.rs:244:14
crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs:157:33
crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs:582:13
crates/biome_diagnostics/src/display/frame.rs:242:57

@Conaclos Conaclos changed the title 🐛 Big pack of js/ts files that crashes ~rome~ biome 🐛 Big pack of js/ts files that crashes biome Jul 8, 2024
@dmythro
Copy link

dmythro commented Oct 14, 2024

It crashes on cyrillic characters as well now (using v1.9.3), but files are in UTF-8:

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: crates/biome_js_factory/src/utils.rs:34:36
Thread Name: biome::worker_7
Message: byte index 44 is not a char boundary; it is inside 'в' (bytes 43..45) of `        <span class="some-popup">від `

./src/some.js internalError/panic  INTERNAL  ━━━━━━━━━━━━

  ✖ processing panicked: byte index 44 is not a char boundary; it is inside 'в' (bytes 43..45) of `        <span class="some-popup">від `

  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.

@Conaclos
Copy link
Member

@dmythro I think it is a regression introduced in 1.9.3 (#4181). I recently fixed it.

@qarmin
Copy link
Author

qarmin commented Oct 15, 2024

2024-10-15 update - biome.zip

@dmythro
Copy link

dmythro commented Oct 16, 2024

@dmythro I think it is a regression introduced in 1.9.3 (#4181). I recently fixed it.

Great! Waiting for the next release to upgrade my projects then :)

@marcusnygren
Copy link

I get a very similar error:

> biome format --write . && biome check --write .

Formatted 67 files in 641ms. Fixed 1 file.
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: crates/biome_js_factory/src/utils.rs:34:36
Thread Name: biome::worker_9
Message: byte index 15 is not a char boundary; it is inside '—' (bytes 14..17) of `Toggle output — `

@Conaclos
Copy link
Member

@marcusnygren This is a regression we fixed in Biome 1.9.4.

@dmythro
Copy link

dmythro commented Oct 23, 2024

Seems like it doesn't crash anymore with v1.9.4 on my project. Nice!

@kristofenyi
Copy link

@marcusnygren This is a regression we fixed in Biome 1.9.4.

For me at Biome 1.9.4 it still has this issue for biome ci

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: /home/runner/work/biome/biome/crates/biome_text_size/src/range.rs:66:9
Thread Name: main
Message: assertion failed: start.raw <= end.raw

@ematipico
Copy link
Member

@kristofenyi, is there any chance to narrow down which code/file emits this panic? Use --log-level=info, that should help.

@kristofenyi
Copy link

kristofenyi commented Oct 31, 2024

@kristofenyi, is there any chance to narrow down which code/file emits this panic? Use --log-level=info, that should help.

command used: yarn biome ci --log-level=info

Source Location: /home/runner/work/biome/biome/crates/biome_text_size/src/range.rs:66:9
Thread Name: main
Message: assertion failed: start.raw <= end.raw

    at crates/biome_cli/src/panic.rs:46 on main

error Command failed with exit code 101.

it fails at some point at a certain .vue file. Not sure if it helps, but

$ wc file.vue 
    348     969   11227

@ematipico
Copy link
Member

What does the .vue file look like? 😅

@kristofenyi
Copy link

What does the .vue file look like? 😅

Add: it happens for both biome ci and biome check

sample file with code that breaks biome file.vue

<template>
  <ATest
    :size="props.atest?.size"
  >
    <ATest2
      fit
      anchor="bottom middle"
      self="top middle"
      :class="props.label"
    >
        <li v-for="item in someVariable" flex-col full-width>
          <div>
            <div class="flex items-center flex-row w-full justify-between">
              <span
                class="text-primary-500 font-bold"
                :title="item.title ?? ''"
                v-text="item.name"
              ></span>

            </div>
          </div>
          <ul v-if="item.nested && item.showNested" class="pl-4">
            <li v-for="nested in item.nested" flex-col full-width>
              <div>
                <div class="flex items-center flex-row w-full justify-between">

                </div>
              </div>
            </li>
          </ul>
        </li>
    </ATest2>
  </ATest>
</template>

<script lang="ts" setup>

const testVariable1 = reactive(props.someVariable ?? {})

const groups = computed(() =>
  Array.isArray(props.items) ? [] : Object.keys(props.items)
)
const testVariable2 = ref<string | undefined>(groups.value[0])
const groupItems = computed(() =>
  selectedGroup.value ? props.items[selectedGroup.value] : props.items
)
const testVariable3 = (index: number, position: 'start' | 'middle' | 'end') => {
  const lastIndex = groups.value.length - 1
  if (position == 'start') return index == 0
  if (position == 'middle') return index > 0 && index < lastIndex
  if (position == 'end') return index == lastIndex
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants