Skip to content

bun crashes for complex shell command #22602

@larslaegnerfrequi

Description

@larslaegnerfrequi

How can we reproduce the crash?

during my husky commit (so package.json script) i start a script that calls biome in some shell scripting. Before only calling a simple statement was fine no errors, but this complex statement breaks very often in 50% or more of my commits.
Technically it is always the second bunx call that fails, never the first.

I am on windows11/bash.

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
$ bunx biome check --staged --files-ignore-unknown=true --no-errors-on-unmatched || (echo 'Biome would change files. Applying fixes…' && bunx biome check --staged --write --files-ignore-unknown=true --no-errors-on-unmatched && echo 'Biome fixed files. Please review & commit again.' && false)
apps\app-personal-dashboard\src\lib\auth\redis-session-store.ts:258:20 lint/performance/noAwaitInLoops ━━━━━━━━━━

  ! Avoid using await inside loops.
  
    256 │     for (const key of keys) {
    257 │       // biome ignore lint/performance/noAwaitInLoops: is only a fallback which should never occur as we have _deleteSessionsBySid() which should be called normally
  > 258 │       const data = await redis.get(key);
        │                    ^^^^^^^^^^^^^^^^^^^^
    259 │       if (!data) continue;
    260 │       try {

  i Using await inside loops might cause performance issues or unintended sequential execution, consider use Promise.all() instead.
  

apps\app-personal-dashboard\src\lib\auth\auth0-forward.ts:5:8 lint/style/useImportType  FIXABLE  ━━━━━━━━━━

  × Some named imports are only used as types.
  
    3 │ import { mapSessionUser } from "@utils/utils-authentication";
    4 │ import { consoleError, consoleLog, logException } from "@utils/utils-general";
  > 5 │ import { NextRequest, NextResponse } from "next/server";
      │        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    6 │ import {
    7 │   auth0AcceptedIssuers,

  i This import is only used as a type.

    3 │ import { mapSessionUser } from "@utils/utils-authentication";
    4 │ import { consoleError, consoleLog, logException } from "@utils/utils-general";
  > 5 │ import { NextRequest, NextResponse } from "next/server";
      │          ^^^^^^^^^^^
    6 │ import {
    7 │   auth0AcceptedIssuers,

  i Importing the types with import type ensures that they are removed by the compilers and avoids loading unnecessary modules.
  
  i Safe fix: Add inline type keywords.

    5 │ import·{·type·NextRequest,·NextResponse·}·from·"next/server";
      │          +++++                                               

Checked 4 files in 8s. No fixes applied.
Found 1 error.
Found 1 warning.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Some errors were emitted while running checks.
  

Biome would change files. Applying fixes…
============================================================
Bun v1.2.21 (7c45ed97) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2 avx512
Args: "C:\Users\laegner\AppData\Local\fnm_multishells\36908_1757685547734\node_modules\bun\bin\bun.exe" "run" "husky:precommit"
Features: bunfig spawn standalone_shell tsconfig tsconfig_paths 
Elapsed: 9834ms | User: 0ms | Sys: 140ms
RSS: 56.38MB | Peak: 56.38MB | Commit: 95.47MB | Faults: 14044

panic(main thread): attempt to use null value
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

Relevant log output

Stack Trace (bun.report)

Bun v1.2.21 (7c45ed9) on windows x86_64 [RunCommand]

panic: attempt to use null value

Features: standalone_shell, tsconfig, tsconfig_paths

Sentry Issue: BUN-V4R

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashAn issue that could cause a crashshellSomething to do with Bun as a shellwindowsAn issue that is known to occur on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions