Skip to content

[Bug]: panics for unused barrel exports when hmr: true #5235

@RomanHotsiy

Description

@RomanHotsiy

Reproduction link or steps

Playground link: https://repl.rolldown.rs/#eNptUMtuwzAM+xVBl7RDkN7TX/HFbeTOgCMVjr0VK/zvk/No12IXw6RJk9IdHfZ39DzQrUtTvTP2T9ziucLxKjHBHZwIFHBRRjDYHU42RgqqM3g0fBaeJFAX5LJT4V4p9RP2KWYqLUYJYZBv7lTo/OVP3D8vSzDd5uCBnM1BCxgGUI6iH4mTDf1CAXyOsYea01Zc5lNyuub0kDiJo1Vo0HtHBmcNwCXIyYZp54f9pgSIlHJklZ7szzxbJcv8teFyRJ3mMfs2xJN46f6xrKvpDroTfW2qebluzhW92Fzmc/LCdeW7tdnaqlGq0U5axfC7PHOeaHh3LGwLItdptmLRFl8aF2yiKWH5Bc5vrAM=

What is expected?

Should not crash

What is actually happening?

It's crashing with

thread '<unnamed>' panicked at crates/rolldown_common/src/types/symbol_ref_db.rs:216:7:
canonical name not found for SymbolRef { owner: 4, symbol: SymbolId(1) }, original_name: "unused"
stack backtrace:
   0:        0x11f68a2ac - _napi_register_module_v1
   1:        0x11efa99b4 - _blake3_compress_in_place_portable
   2:        0x11f688a74 - _napi_register_module_v1
   3:        0x11f68a16c - _napi_register_module_v1
   4:        0x11f688668 - _napi_register_module_v1
   5:        0x11f6b0760 - _napi_register_module_v1
   6:        0x11f6b06d0 - _napi_register_module_v1
   7:        0x11f6b1d3c - _napi_register_module_v1
   8:        0x11f71641c - _napi_register_module_v1
   9:        0x11f773890 - _napi_register_module_v1
  10:        0x11f54e06c - _napi_register_module_v1
  11:        0x11f49f328 - _napi_register_module_v1
  12:        0x11f49b020 - _napi_register_module_v1
  13:        0x11f52c738 - _napi_register_module_v1
  14:        0x11ee21e7c - <unknown>
  15:        0x11ed12d24 - <unknown>
  16:        0x11ee22390 - <unknown>
  17:        0x11ed12dac - <unknown>
  18:        0x11ee22390 - <unknown>
  19:        0x11ee9e50c - <unknown>
[error] Uncaught exception occurred. Stopping compilers.
[error] Exiting due to uncaught exception
[error] Panic in async function
Error: Panic in async function

System Info

System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 124.58 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.17.0 - ~/.asdf/cache/installs/nodejs/22.17.0/bin/node
    npm: 10.9.2 - ~/.asdf/cache/plugins/nodejs/shims/npm
    pnpm: 10.10.0 - ~/.asdf/cache/shims/pnpm
    bun: 1.1.36 - ~/.bun/bin/bun
  Browsers:
    Chrome: 138.0.7204.94
    Safari: 18.5

Any additional comments?

It's not crashing if I set treeshake: false or disable hmr.

I can also reproduce the same issue on my private codebase even with treeshake: false but I can't come up with minimal reproducible sample. Maybe it's related to circular imports or/and dynamic imports.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions