Skip to content

oxfmt fails to format HTML files when running with --bun #40298

Description

@samcragg

What version of Bun is running?

1.4.0+34cbb9a40

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What steps can reproduce the bug?

Running bunx oxfmt works but uses node behind the scenes. Adding the --bun option then causes it to fail. Note I've added the --no-install option because the error is different without it and the process seems to hang. To reproduce, you just need a html file to get formatted by oxfmt. In the attached package.json there are two scripts to help demonstrate.

This works:

bun install
bun run fmt:node

This doesn't:

bun install
bun run fmt:node

package.json
index.html

What is the expected behavior?

Running bunx oxfmt and bunx --bun oxfmt should produce the same output. This does work for ts files, for example, just seems to be related to html ones (potentially others, I've only checked these two types of files)

What do you see instead?

bun run fmt:bun
$ bunx --bun --no-install oxfmt

× Error: Worker exited unexpectedly
│ [index.html]
Error occurred when checking code style in the above files.
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
74 | this.threadId = this.process.pid;
75 | this.process.on("exit", this.onUnexpectedExit);
76 | this.waitForExit = new Promise((r) => this.process.on("exit", r));
77 | }
78 | onUnexpectedExit = () => {
79 | this.process.emit("error", new Error("Worker exited unexpectedly"));
^
error: Worker exited unexpectedly
at onUnexpectedExit (D:\GitHub\bun-oxfmt-error\node_modules\tinypool\dist\index.js:79:34)
at emit (node:events:124:23)
at #handleOnExit (node:child_process:578:14)
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.
error: Could not find an existing '' binary to run. Stopping because --no-install was passed.

Bun v1.4.0 (Windows x64)
error: script "fmt:bun" exited with code 1

Additional information

No response

Activity

  1. robobun commented on Aug 24, 2026

    @robobun
    Collaborator

    Reproduced on Windows: bunx --bun boots the bin script inside the bunx.exe process, so process.execPath points at bunx.exe and process.execArgv carries the bunx CLI flags, which breaks child_process.fork() (tinypool, used by oxfmt for HTML).
    Fix in progress: #40300

  2. added a commit that references this issue on Aug 25, 2026
    656bfb9
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions