Bun "bunfig.toml" Configuration Error in CI
Bun could not parse or apply bunfig.toml. The file has invalid TOML, a key in the wrong section, or a registry/scope block Bun cannot use - so the command that reads config fails.
What this error means
A bun install/bun test/bun run command fails early complaining about the config - a TOML parse error, an unknown/misplaced key, or an unusable registry entry in bunfig.toml.
bun output
error: failed to parse bunfig.toml: expected ']' to close table header
at bunfig.toml:6
# or
error: invalid registry URL in [install.scopes]Common causes
Invalid TOML syntax
A malformed table header, unquoted value, or stray character makes bunfig.toml unparseable, so Bun cannot read any config.
Key in the wrong section
Config under the wrong table (e.g. a test option outside [test], a registry outside [install]) is ignored or rejected.
How to fix it
Validate and correct the TOML
Fix the syntax and place keys in their proper sections.
bunfig.toml
# bunfig.toml
[install]
registry = "https://registry.npmjs.org"
[install.scopes]
"@my-org" = { url = "https://npm.pkg.github.com", token = "$GH_TOKEN" }
[test]
preload = ["./test/setup.ts"]Confirm which config Bun loads
- Bun reads
bunfig.tomlfrom the project root (and a global one) - make sure CI runs where the file is. - Remove duplicate/conflicting keys across global and local configs.
- Keep secrets as
$ENVreferences, not committed literals.
How to prevent it
- Lint/validate
bunfig.tomlas TOML in CI. - Keep registry/scope/test keys in their correct sections.
- Reference tokens via env vars, never commit them.
Related guides
Bun "bun test" Fails or Hangs in CIFix "bun test" failures in CI - a test runner API mismatch (Jest globals), an unconfigured preload, or async…
Bun "--frozen-lockfile" Mismatch in CIFix "bun install --frozen-lockfile" failures in CI - package.json changed but bun.lock(b) was not updated, or…
Bun "node:" Module Compatibility Errors in CIFix Bun "node:" module compatibility failures in CI - an unimplemented Node built-in API, or code importing a…