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

InvalidCssImport

InvalidCssImport

Error message

InvalidCssImport

What it means

Sentinel for an invalid CSS import: a CSS file (or CSS `@import`) appears in a context where CSS is not allowed, or imports something that cannot be a stylesheet. The build rejects the record rather than silently skipping it.

Solutions

  1. Remove the CSS import from JS/TS code or move it to an allowed entry point
  2. Use the `with { type: 'css' }` / bundler-supported CSS import syntax if importing styles into JS
  3. Check the imported path actually points to a .css file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/bundler/error.rs:13 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/4c077f376add6e58. Report an issue: GitHub.

Appendix: source

Thrown at src/bundler/error.rs:13

#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
pub enum Error {
    #[error("InvalidRecordKind")]
    InvalidRecordKind,
    #[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")]

View on GitHub (pinned to 8c5296ac45)