Skip to content

[Bug]: panic assertion failed: self.backup.is_some() in the compilation after one whose finishMake tap rejected #16578

Closed

Description

@Sheraff

Written by an AI coding agent (Claude) on behalf of a TanStack Router maintainer; reproduced locally.

System Info

System: Linux 6.12 x64 (Debian 13)
Binaries: Node 26.12.1, npm 12.2.0
npmPackages: @rspack/core 2.3.2 (also 2.3.3-canary-25976e8d-20261110173021)

Details

When a finishMake tap rejects, that compilation fails as expected. The next compilation on the same compiler then aborts the process (exit 134). In watch mode, a dev server dies on the first rebuild after a plugin error.

const { rspack } = require('@rspack/core')

let compilations = 0
const compiler = rspack({
  mode: 'development',
  entry: './a.js',
  plugins: [{
    apply(compiler) {
      compiler.hooks.finishMake.tapPromise('repro', async () => {
        if (++compilations === 1) throw new Error('finishMake failed')
      })
    },
  }],
})

compiler.run((err) => {
  console.log('run 1:', err ? 'error' : 'ok')
  setTimeout(() => compiler.run((err) => console.log('run 2:', err ? 'error' : 'ok')))
})

Actual:

run 1: error
Panic occurred at runtime. Please file an issue on GitHub with the panic info and backtrace below: https://github.com/web-infra-dev/rspack/issues
thread 'tokio-28' panicked at <redacted>:0:0:
assertion failed: self.backup.is_some()

On 2.0.0 the location is crates/rspack_core/src/module_graph/rollback/atom.rs:45:5.

Expected: the second compilation runs, as on webpack 5.112.2 and @rspack/core 1.7.12 (run 2: ok).

Reproduce link

https://github.com/Sheraff/rspack-panic-after-failed-compilation

Reproduce Steps

  1. npm install
  2. node hook.cjs: two compiler.run(), the first fails, the second panics
  3. node hook.cjs --watch: same in watch mode, through watching.invalidate()
  4. Controls: node hook.cjs --control (nothing throws), node hook.cjs --webpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions