Skip to content

process.argv includes BUN_OPTIONS in compiled executable which can break arg processing #21496

Closed

Description

@adamhl8

What version of Bun is running?

1.2.19+aad3abead

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

index.ts

console.log(process.argv)
$ export BUN_OPTIONS='--bun'
$ bun ./index.ts "myArg"
[ "/opt/homebrew/Cellar/bun/1.2.19/bin/bun", "/Users/adam/index.ts", "myArg" ]
$ bun build --compile --outfile=index ./index.ts
$ ./index "myArg"
[ "bun", "/$bunfs/root/index", "--bun", "myArg" ]

The third argument should be "myArg", but is instead whatever I have set on BUN_OPTIONS.

Activity

  1. self-assigned this
    on Jan 21, 2026
  2. added a commit that references this issue on Jan 23, 2026
    d8d8182
  3. added a commit that references this issue on May 14, 2026
    23e4f60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbundlerSomething to do with the bundlersingle-file-executablebun build --compile

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions