Skip to content

[Bug]: "Failed to get stats" HMR crash #9687

@RobHannay

Description

@RobHannay

Version

System:
    OS: macOS 15.3.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 78.00 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 134.0.6998.89
    Safari: 18.3.1
  npmPackages:
    @rsbuild/core: 1.2.18 => 1.2.18 
    @rsbuild/plugin-babel: 1.0.4 => 1.0.4 
    @rsbuild/plugin-css-minimizer: 1.0.2 => 1.0.2 
    @rsbuild/plugin-mdx: 1.0.2 => 1.0.2 
    @rsbuild/plugin-node-polyfill: 1.3.0 => 1.3.0 
    @rsbuild/plugin-react: 1.1.1 => 1.1.1 
    @rsbuild/plugin-type-check: 1.2.1 => 1.2.1

Details

I'm struggling to reliably reproduce, but wanted to highlight that it's still somehow trying to access stats that it can't find when doing HMR.

If you can't investigate further without a repro then feel free to close this issue. I will try and understand a pattern for it to occur

● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (98%) emitting emit                                                                                                                                                                                             Failed to get stats due to error: Unable to access compilation with id = CompilationId(1) now. The compilation have been removed on the Rust side. The latest compilation id is CompilationId(742), are you trying to access the stats from the previous compilation?
file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5275
        if (statsJson.entrypoints) for (let entrypoint of Object.values(statsJson.entrypoints)){
                      ^

TypeError: Cannot read properties of null (reading 'entrypoints')
    at SocketServer.sendStats (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5275:23)
    at SocketServer.onConnect (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5244:32)
    at WebSocketServer.<anonymous> (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5203:18)
    at WebSocketServer.emit (node:events:518:28)
    at file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5186:27
    at WebSocketServer.completeUpgrade (/Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/compiled/ws/index.js:2213:11)
    at WebSocketServer.handleUpgrade (/Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/compiled/ws/index.js:2150:16)
    at SocketServer.upgrade (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5185:58)
    at CompilerDevMiddleware.upgrade (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:5491:27)
    at Object.onUpgrade (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:6150:57)
    at Http2SecureServer.onUpgrade (file:///Users/robhannay/web/node_modules/.pnpm/@rsbuild+core@1.2.18/node_modules/@rsbuild/core/dist/index.js:6066:42)
    at Http2SecureServer.emit (node:events:518:28)
    at onParserExecuteCommon (node:_http_server:950:14)
    at onParserExecute (node:_http_server:852:3)

Node.js v22.14.0

Image

Followed up (from a child process I assume) with

Error: write EPIPE
    at target._send (node:internal/child_process:877:20)
    at target.send (node:internal/child_process:751:19)
    at /Users/robhannay/web/node_modules/.pnpm/ts-checker-rspack-plugin@1.1.1_@rspack+core@1.2.3_@swc+helpers@0.5.15__typescript@5.7.3/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:18:31
    at new Promise (<anonymous>)
    at sendMessage (/Users/robhannay/web/node_modules/.pnpm/ts-checker-rspack-plugin@1.1.1_@rspack+core@1.2.3_@swc+helpers@0.5.15__typescript@5.7.3/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:10:38)
    at process.handleMessage (/Users/robhannay/web/node_modules/.pnpm/ts-checker-rspack-plugin@1.1.1_@rspack+core@1.2.3_@swc+helpers@0.5.15__typescript@5.7.3/node_modules/ts-checker-rspack-plugin/lib/rpc/expose-rpc.js:51:27) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Reproduce link

As I can't provide reliable repro steps, I can't necessarily make a minimal one

Reproduce Steps

  1. Run pnpm rsbuild dev
  2. Edit a file
  3. Sometimes, this error is thrown

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions