oven-sh/bun · error · bun_bundler::Error
InvalidJSON
InvalidJSON
Error message
InvalidJSON
What it means
Sentinel variant of the bundler Error enum: a JSON input the bundler needed to parse (e.g. package.json, tsconfig, or an imported .json module in some paths) is not valid JSON. The parse error details live at the throw site; the variant itself is just the machine-readable name.
Solutions
- Fix the JSON syntax at the reported position (trailing commas, comments in strict JSON, etc.)
- Validate the file with a JSON parser
- Rename to .jsonc if comments were intended and the loader supports it
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/bundler/error.rs:23 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/b41ac722ef0eed4c.
Report an issue: GitHub.
Appendix: source
Thrown at src/bundler/error.rs:23
#[error("ModuleNotFound")]
ModuleNotFound,
#[error("BuildFailed")]
BuildFailed,
#[error("CompilationFailed")]
CompilationFailed,
#[error("Plugin")]
Plugin,
#[error("InvalidCssImport")]
InvalidCssImport,
#[error("PrintError")]
PrintError,
#[error("WriteFailed")]
WriteFailed,
#[error("DuplicateOutputPath")]
DuplicateOutputPath,
#[error("MultipleOutputFilesWithoutOutputDir")]
MultipleOutputFilesWithoutOutputDir,
#[error("InvalidJSON")]
InvalidJSON,
#[error("Fail")]
Fail,
#[error("ParserError")]
ParserError,
#[error("SyntaxError")]
SyntaxError,
#[error("MinifyError")]
MinifyError,
#[error("InvalidNativePlugin")]
InvalidNativePlugin,
#[error("EmptyAST")]
EmptyAST,
#[error("FormatError")]
FormatError,
#[error("ResolveMessage")]
ResolveMessage,
#[error("JSError")]View on GitHub (pinned to 8c5296ac45)