oven-sh/bun · error · bundler::Error

ParserError

Error message

ParserError

What it means

Sentinel variant of the bundler Error enum: the JavaScript/TypeScript parser rejected the source with a syntax-level parse failure that is reported through the bundler's error channel. Distinct from SyntaxError, which covers later syntax-related diagnostics; consumers match on the variant.

Solutions

  1. Fix the syntax error at the reported line/column
  2. Check the file's loader matches its syntax (e.g. JSX in a .js file needs the right loader)
  3. Preprocess non-standard syntax (macros, exotic proposals) before bundling
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/bundler/error.rs:27 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/63111aa0bcdc4c2f. Report an issue: GitHub.

Appendix: source

Thrown at src/bundler/error.rs:27

    #[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")]
    Js(bun_core::JsError),
    #[error(transparent)]
    Sys(#[from] bun_errno::SystemErrno),
    #[error(transparent)]

View on GitHub (pinned to 8c5296ac45)