Skip to content

Bun.build crashes with Windows + workspaces + build.onResolve plugin #26798

@guyutongxue

Description

@guyutongxue

What version of Bun is running?

1.3.8+b64edcb49

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What steps can reproduce the bug?

Full minimal reproduction example can be found at https://github.com/guyutongxue/bunup-bug-repro. Run bun i; bun repro to crash Bun.

In summary:

  • Windows only;
  • With workspace monorepo, and one of its package imports a dependency from node_modules
  • Run Bun.build with an empty plugin:
[
  {
    name: "empty",
    setup(build) {
      build.onResolve({ filter: /.*/ }, (args) => {
        return null;
      });
    },
  },
]

What is the expected behavior?

It builds.

What do you see instead?

It crashes.

============================================================
Bun v1.3.8 (b64edcb4) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "C:\Users\guyutongxue\.bun\bin\bun.exe" "build.ts"
Features: jsc 
Builtins: "bun:main" 
Elapsed: 52ms | User: 15ms | Sys: 31ms
RSS: 0.15GB | Peak: 0.15GB | Commit: 0.44GB | Faults: 36220 | Machine: 16.98GB

panic(thread 23276): Expected pretty file path to have only forward slashes, got 'C:\Users\guyutongxue\Downloads\temp\bunup-bug-repro\packages\test\node_modules\@volar\language-server\index.js'
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.3.8/wa1b64edcbAggggCi7zoekg0ne2lxhC6upheCYKERNEL32.DLLut0LCSntdll.dll4zijBA0eNoVyTEOwjAMBdCreOtCOQATEnAENkvIkE9aCHFkO6W9PeKt77I2PAKJmiFio+dcQE1iolCaZAFpLRs91b5iibyIT/AdZQ0aTge+Osw5962H1rx28Fm/tagk58Cn8b3X3sZ7z6OhmXKTx1sy/uvBVRNuH029wPm4aBHjIjV3yRgdtsB4rgnr/uXDDyZpQos

error: script "repro" exited with code 3

Additional information

The decoded stack trace is:

Bun v1.3.8 ([`b64edcb`](<https://github.com/oven-sh/bun/tree/b64edcb490b486fb8af90cb2cb2dc51590453064>)) on windows x86_64 [AutoCommand]

**panic**: Expected pretty file path to have only forward slashes, got 'C:\Users\guyutongxue\Downloads\temp\bunup-bug-repro\packages\test\node_modules\@volar\language-server\index.js'

- [`highway.zig:97`](<https://github.com/oven-sh/bun/blob/b64edcb490b486fb8af90cb2cb2dc51590453064/src/highway.zig#L97>): `indexOfChar`
- [`bundle_v2.zig:2527`](<https://github.com/oven-sh/bun/blob/b64edcb490b486fb8af90cb2cb2dc51590453064/src/bundler/bundle_v2.zig#L2527>): `onResolve`
- [`linear_fifo.zig:205`](<https://github.com/oven-sh/bun/blob/b64edcb490b486fb8af90cb2cb2dc51590453064/src/linear_fifo.zig#L205>): `readItem`
- [`bundle_v2.zig:2730`](<https://github.com/oven-sh/bun/blob/b64edcb490b486fb8af90cb2cb2dc51590453064/src/bundler/bundle_v2.zig#L2730>): `runFromJSInNewThread`

Features: transpiler\_cache, tsconfig, tsconfig\_paths, process\_dlopen, Bun.stderr, Bun.stdin, Bun.stdout, jsc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions