Skip to content

Bun throws Error instead of AggregateError on Promise.reject within Promise.any #29157

@kevgeoleo

Description

@kevgeoleo

What version of Bun is running?

1.3.11-canary.1+9e93bfa1b

What platform is your computer?

Linux 5.10.0-12-amd64 x86_64 x86_64

What steps can reproduce the bug?

Hi,

I would like to report a behavior in Bun that can be reproduced using the below snippet:

await Promise.any([Promise.reject(Error(""))]).catch(console.dir);

What is the expected behavior?

root@KContainer:~/14496# node poc.mjs
[AggregateError: All promises were rejected] {
  [errors]: [
    Error
        at file:///14496/a.mjs:1:35
        at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:661:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)
  ]
}

What do you see instead?

root@KContainer:~/14496# bun run poc.mjs
1 | await Promise.any([Promise.reject(Error(""))]).catch(console.dir);
                                      ^
Error:
      at /home/c01kele/git/run/cerebras/deno/OPENAI/gpt5.1/filter/batch_2/cross_runtime/temp_node/14496/a.mjs:1:35
      at loadAndEvaluateModule (2:1)

Additional information

No response

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