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

SyntaxError

Error message

SyntaxError

What it means

Sentinel variant of the bundler Error enum: the AST failed a syntax/semantic validity check after parsing (e.g. an invalid construct discovered while validating the parsed tree). The detailed diagnostic with location is produced at the throw site; this variant only classifies the failure category.

Solutions

  1. Correct the invalid syntax at the reported location
  2. Verify the file targets supported JS/TS/JSX syntax for the configured target
  3. Check for accidental binary or wrong-extension files being loaded as JS
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/bundler/error.rs:29 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/23503c61dea4cc2c. Report an issue: GitHub.

Appendix: source

Thrown at src/bundler/error.rs:29

    #[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)]
    Alloc(#[from] bun_alloc::AllocError),
    #[error(transparent)]

View on GitHub (pinned to 8c5296ac45)