swc icon indicating copy to clipboard operation
swc copied to clipboard

panic: Formatting argument out of range

Open Clashsoft opened this issue 7 months ago • 0 comments

Describe the bug

The code (found in the package @beisen/[email protected] as extras/all-in-one-common-1809101611.min.js) produces a Rust panic:

thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/miette-7.5.0/src/handlers/graphical.rs:1134:22:
Formatting argument out of range

stack backtrace:
   0:        0x12af04be0 - _napi_register_module_v1
   1:        0x12aa9cfc0 - _blake3_compress_in_place_portable
   2:        0x12af033a0 - _napi_register_module_v1
   3:        0x12af04aa0 - _napi_register_module_v1
   4:        0x12af02f98 - _napi_register_module_v1
   5:        0x12af34880 - _napi_register_module_v1
   6:        0x12af34818 - _napi_register_module_v1
   7:        0x12af36bd0 - _napi_register_module_v1
   8:        0x12c04c8e8 - _wasmer_eh_personality
   9:        0x12acfc040 - _blake3_compress_in_place_portable
  10:        0x12acf5ef4 - _blake3_compress_in_place_portable
  11:        0x12acf3c50 - _blake3_compress_in_place_portable
  12:        0x12ba19100 - _napi_register_module_v1
  13:        0x12ba1ab54 - _napi_register_module_v1
  14:        0x12a972c64 - <unknown>
  15:        0x1048c3ce8 - __ZZN4node14ThreadPoolWork12ScheduleWorkEvENKUlP9uv_work_sE_clES2_
  16:        0x1048c3a44 - __ZZN4node14ThreadPoolWork12ScheduleWorkEvENUlP9uv_work_sE_8__invokeES2_
  17:        0x1081a7130 - _worker
  18:        0x19a616c0c - __pthread_cond_wait
fatal runtime error: failed to initiate panic, error 5, aborting

all-in-one-common-1809101611.min.js

Input code

// Too long to paste. See attached file in description.

Config

await swcParse(content, {
      syntax: 'ecmascript',
      jsx: true,
      decorators: true,
    });

Link to the code that reproduces this issue

Too long to paste.

SWC Info output

This project is configured to use pnpm because /Users//package.json has a "packageManager" field

Operating System:
    Platform: darwin
    Arch: arm64
    Machine Type: arm64
    Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:25 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6020
    CPU: (12 cores)
        Models: Apple M2 Max

Binaries:
    Node: 23.11.0
    npm: 10.9.2
    Yarn: N/A
    pnpm: 10.9.0

Relevant Packages:
    @swc/core: 1.11.29
    @swc/helpers: 0.5.17
    @swc/types: N/A
    typescript: 5.7.3

SWC Config:
    output: N/A
    .swcrc path: N/A

Next.js info:
    output: N/A

Expected behavior

No error.

Actual behavior

See description.

Version

1.11.29

Additional context

I encountered the code in an npm package. SWC is used to parse the code of all packages.

Clashsoft avatar May 23 '25 19:05 Clashsoft