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

InvalidPackageJSON

Error message

InvalidPackageJSON

What it means

A dependency's package.json could not be parsed as valid JSON (or was missing required fields) while resolving during install. It fires when the package manifest fetched from the registry or read from disk is malformed, so the resolver cannot extract name/version/dependencies.

Solutions

  1. Check that the failing package's package.json is valid JSON (run it through a JSON validator)
  2. If the error is from a registry tarball, clear the cached package and re-fetch it
  3. Pin the dependency to a known-good published version in package.json
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/install/error.rs:53 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/fc524f3d95301966. Report an issue: GitHub.

Appendix: source

Thrown at src/install/error.rs:53

    #[error("TarballFailedToDownload")]
    TarballFailedToDownload,
    #[error("BadRequest")]
    BadRequest,
    #[error("TooManyRequests")]
    TooManyRequests,
    #[error("HTTPInternalServerError")]
    HTTPInternalServerError,
    #[error("UnexpectedNotModified")]
    UnexpectedNotModified,
    #[error("PackageFailedToParse")]
    PackageFailedToParse,
    #[error("BufferTooSmall")]
    BufferTooSmall,
    #[error("DanglingSymlink")]
    DanglingSymlink,
    #[error("UnsupportedYarnLockfileVersion")]
    UnsupportedYarnLockfileVersion,
    #[error("InvalidPackageJSON")]
    InvalidPackageJSON,
    #[error("LockfileResolveFailed")]
    LockfileResolveFailed,
    #[error("DistTagNotFound")]
    DistTagNotFound,
    #[error("NoMatchingVersion")]
    NoMatchingVersion,
    #[error("TooRecentVersion")]
    TooRecentVersion,
    #[error("MissingPackageJSON")]
    MissingPackageJSON,
    #[error("InstallFailed")]
    InstallFailed,
    #[error("HTTPError")]
    HTTPError,
    #[error("Failed")]
    Failed,
    #[error("UnrecognizedDependencyFormat")]

View on GitHub (pinned to 8c5296ac45)