{"record":{"id":"83568775ef47f138","repo":"oven-sh/bun","slug":"missinglevelfield","errorCode":null,"errorMessage":"MissingLevelField","messagePattern":"MissingLevelField","errorType":"exception","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":139,"sourceCode":"    #[error(\"SecurityScannerFailed\")]\n    SecurityScannerFailed,\n    #[error(\"SecurityScannerTerminated\")]\n    SecurityScannerTerminated,\n    #[error(\"InvalidAdvisoriesFormat\")]\n    InvalidAdvisoriesFormat,\n    #[error(\"InvalidAdvisoryFormat\")]\n    InvalidAdvisoryFormat,\n    #[error(\"MissingPackageField\")]\n    MissingPackageField,\n    #[error(\"InvalidPackageField\")]\n    InvalidPackageField,\n    #[error(\"EmptyPackageField\")]\n    EmptyPackageField,\n    #[error(\"InvalidDescriptionField\")]\n    InvalidDescriptionField,\n    #[error(\"InvalidUrlField\")]\n    InvalidUrlField,\n    #[error(\"MissingLevelField\")]\n    MissingLevelField,\n    #[error(\"InvalidLevelField\")]\n    InvalidLevelField,\n    #[error(\"InvalidLevelValue\")]\n    InvalidLevelValue,\n    #[error(\"Missing global bin directory: try setting $BUN_INSTALL\")]\n    MissingGlobalBinDirectoryTrySettingBUNINSTALL,\n    #[error(\"InvalidURL\")]\n    InvalidURL,\n    #[error(\"Fail\")]\n    Fail,\n    #[error(\"IntegrityCheckFailed\")]\n    IntegrityCheckFailed,\n    #[error(\"RepositoryNotFound\")]\n    RepositoryNotFound,\n    #[error(\"DebugTextLockfileRoundTrip\")]\n    DebugTextLockfileRoundTrip,\n    #[error(\"NoPackage\")]","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L121-L157","documentation":"Sentinel variant of the install Error enum: while validating an advisory from the security scanner, its JSON lacks the required severity 'level' field. One of the advisory-schema validation variants (alongside InvalidPackageField, InvalidDescriptionField, etc.) guarding the scanner's output shape.","triggerScenarios":"Scanner emits {\"package\":\"foo\",\"description\":\"...\"} with no level, or uses an alternative key like \"severity\"/\"impact\" that Bun ignores.","commonSituations":"Porting advisories from npm audit (which uses \"severity\": \"high\"); scanners whose schema uses severity buckets that were never mapped to fatal/warn.","solutions":["Re-run `bun pm audit`; malformed advisories can come from a truncated registry response","Update Bun to pick up audit parsing fixes","Report persistent malformed audit data to Bun's issues"],"exampleFix":"// before\nadvisories: [{ package: \"foo\", severity: \"high\" }]\n\n// after\nconst level = (s) => (s === \"critical\" || s === \"high\" ? \"fatal\" : \"warn\");\nadvisories: [{ package: \"foo\", level: level(\"high\") }]","handlingStrategy":"validation","validationCode":"// scanner-side: every advisory must carry a level before sending\nconst LEVELS = new Set([\"fatal\", \"warn\"]);\nconst advisories = raw.filter((a) => LEVELS.has(a.level));","typeGuard":"const hasLevel = (a) => a?.level === \"fatal\" || a?.level === \"warn\";","tryCatchPattern":null,"preventionTips":["Set level in the advisory constructor so it cannot be forgotten","Rename severity/impact keys to level when importing foreign formats","Include level in required-field assertions in scanner tests"],"tags":["security-scanner","json","schema","severity"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","contentChangedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}