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

Panic called Option::unwrap() on a None value in unicorn/escape_case rule #9583

Closed
qarmin opened this issue Mar 7, 2025 · 1 comment · Fixed by #9638
Closed

Panic called Option::unwrap() on a None value in unicorn/escape_case rule #9583

qarmin opened this issue Mar 7, 2025 · 1 comment · Fixed by #9638
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers

Comments

@qarmin
Copy link

qarmin commented Mar 7, 2025

File content(at the bottom should be attached raw, not formatted file - github removes some non-printable characters, so copying from here may not work):

e`\u`

command

timeout -v 150 oxlint -D all -D nursery --import-plugin --jsdoc-plugin --jest-plugin --vitest-plugin --jsx-a11y-plugin --nextjs-plugin --react-perf-plugin TEST___FILE.js --fix --fix-suggestions --fix-dangerously

cause this

thread '<unnamed>' panicked at crates/oxc_linter/src/rules/unicorn/escape_case.rs:98:50:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0: rust_begin_unwind
             at /rustc/30f168ef811aec63124eac677e14699baa9395bd/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/30f168ef811aec63124eac677e14699baa9395bd/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/30f168ef811aec63124eac677e14699baa9395bd/library/core/src/panicking.rs:145:5
   3: core::option::unwrap_failed
             at /rustc/30f168ef811aec63124eac677e14699baa9395bd/library/core/src/option.rs:2015:5
   4: core::option::Option<T>::unwrap
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:978:21
   5: oxc_linter::rules::unicorn::escape_case::check_case
             at ./oxc-main/crates/oxc_linter/src/rules/unicorn/escape_case.rs:98:50
   6: <oxc_linter::rules::unicorn::escape_case::EscapeCase as oxc_linter::rule::Rule>::run::{{closure}}
             at ./oxc-main/crates/oxc_linter/src/rules/unicorn/escape_case.rs:132:42
   7: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::for_each
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/iter/macros.rs:277:21
   8: <oxc_linter::rules::unicorn::escape_case::EscapeCase as oxc_linter::rule::Rule>::run
             at ./oxc-main/crates/oxc_linter/src/rules/unicorn/escape_case.rs:130:17
   9: oxc_linter::Linter::run
             at ./oxc-main/crates/oxc_linter/src/lib.rs:198:21
  10: oxc_linter::service::runtime::Runtime::process_source
             at ./oxc-main/crates/oxc_linter/src/service/runtime.rs:275:9
  11: oxc_linter::service::runtime::Runtime::process_path
             at ./oxc-main/crates/oxc_linter/src/service/runtime.rs:154:32
  12: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter::with::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:317:22
  13: core::iter::adapters::map::map_fold::{{closure}}
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:88:28
  14: core::iter::traits::iterator::Iterator::fold
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:2546:21
  15: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:128:9
  16: core::iter::traits::iterator::Iterator::for_each
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:800:9
  17: <rayon::iter::noop::NoopConsumer as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/noop.rs:34:9
  18: <rayon::iter::map_with::MapWithFolder<C,U,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:322:25
  19: rayon::iter::plumbing::Producer::fold_with
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
  20: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
  21: rayon::iter::plumbing::bridge_producer_consumer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
  22: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
  23: <rayon::vec::Drain<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:147:13
  24: <rayon::vec::IntoIter<T> as rayon::iter::IndexedParallelIterator>::with_producer
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:83:9
  25: rayon::iter::plumbing::bridge
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
  26: <rayon::vec::IntoIter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/vec.rs:58:9
  27: <rayon::collections::hash_set::Iter<T> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/delegate.rs:21:28
  28: <rayon::iter::map_with::MapWith<I,T,F> as rayon::iter::ParallelIterator>::drive_unindexed
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/map_with.rs:53:9
  29: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<()> for ()>::from_par_iter
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/from_par_iter.rs:308:9
  30: rayon::iter::ParallelIterator::collect
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/mod.rs:2069:9
  31: rayon::iter::ParallelIterator::for_each_with
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-1.10.0/src/iter/mod.rs:417:33
  32: oxc_linter::service::LintService::run
             at ./oxc-main/crates/oxc_linter/src/service/mod.rs:95:14
  33: <oxlint::lint::LintRunner as oxlint::runner::Runner>::run::{{closure}}
             at ./oxc-main/apps/oxlint/src/lint.rs:367:17
  34: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  35: std::panicking::try::do_call
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  36: std::panicking::try
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  37: std::panic::catch_unwind
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:359:14
  38: rayon_core::unwind::halt_unwinding
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/unwind.rs:17:5
  39: rayon_core::registry::Registry::catch_unwind
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:367:27
  40: rayon_core::spawn::spawn_job::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/spawn/mod.rs:97:13
  41: <rayon_core::job::HeapJob<BODY> as rayon_core::job::Job>::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/job.rs:169:9
  42: rayon_core::job::JobRef::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/job.rs:64:9
  43: rayon_core::registry::WorkerThread::execute
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:860:13
  44: rayon_core::registry::WorkerThread::wait_until_cold
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:794:26
  45: rayon_core::registry::WorkerThread::wait_until
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:769:13
  46: rayon_core::registry::WorkerThread::wait_until_out_of_work
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:818:9
  47: rayon_core::registry::main_loop
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:923:5
  48: rayon_core::registry::ThreadBuilder::run
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:53:18
  49: <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
             at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rayon-core-1.12.1/src/registry.rs:98:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

##### Automatic Fuzzer note, output status "None", output signal "Some(6)"

compressed.zip

@qarmin qarmin added the C-bug Category - Bug label Mar 7, 2025
@leaysgur leaysgur changed the title Panic called Option::unwrap() on a None value in EscapeCase rule Panic called Option::unwrap() on a None value in unicorn/escape_case rule Mar 7, 2025
@leaysgur leaysgur added the A-linter Area - Linter label Mar 7, 2025
@Boshen Boshen added the good first issue Experience Level - Good for newcomers label Mar 7, 2025
@therewillbecode
Copy link
Contributor

Yep seems like some non printable characters are removed by Github as that example isn't causing a panic for me.

graphite-app bot pushed a commit that referenced this issue Mar 10, 2025
closes #9583, #9585

Related to #9568

This is a regression issue caused by my refactoring. I have fixed it and added corresponding test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-bug Category - Bug good first issue Experience Level - Good for newcomers
Projects
None yet
5 participants