{"record":{"id":"6d6bd25633a1f997","repo":"oven-sh/bun","slug":"unknownmessagetype","errorCode":null,"errorMessage":"UnknownMessageType","messagePattern":"UnknownMessageType","errorType":"exception","errorClass":"bun_install::Error","httpStatus":null,"severity":"error","filePath":"src/install/error.rs","lineNumber":117,"sourceCode":"    #[error(\"MissingIPCType\")]\n    MissingIPCType,\n    #[error(\"InvalidIPCType\")]\n    InvalidIPCType,\n    #[error(\"MissingErrorCode\")]\n    MissingErrorCode,\n    #[error(\"InvalidErrorCode\")]\n    InvalidErrorCode,\n    #[error(\"UnknownErrorCode\")]\n    UnknownErrorCode,\n    #[error(\"SecurityScannerNotFound\")]\n    SecurityScannerNotFound,\n    #[error(\"SecurityScannerNotInDependencies\")]\n    SecurityScannerNotInDependencies,\n    #[error(\"InvalidScannerVersion\")]\n    InvalidScannerVersion,\n    #[error(\"ScannerFailed\")]\n    ScannerFailed,\n    #[error(\"UnknownMessageType\")]\n    UnknownMessageType,\n    #[error(\"MissingAdvisoriesField\")]\n    MissingAdvisoriesField,\n    #[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\")]","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/error.rs#L99-L135","documentation":"The security scanner's IPC response JSON parsed correctly and had a string `type` field, but the value was neither \"error\" nor \"result\" — the only two message types Bun's protocol accepts (security_scanner.rs:1685-1690). This almost always indicates a scanner implementation bug or a protocol mismatch.","triggerScenarios":"A custom scanner writes a JSON object to IPC with e.g. \"type\":\"results\" (typo), \"type\":\"scan-result\", or emits a progress/log message type Bun does not understand. Any type string outside the exact set {\"error\", \"result\"} triggers it.","commonSituations":"Writing your own security scanner and guessing the protocol; a scanner version that added new message types (telemetry, progress) that this Bun version does not support; trailing garbage concatenated into the IPC stream being parsed as a second message.","solutions":["In your scanner, emit exactly {\"type\":\"result\",\"advisories\":[...]} on success and {\"type\":\"error\",\"code\":...,\"message\":...} on failure","Check the printed 'Unknown security scanner message type: <t>' value for typos in your scanner's writer","Upgrade Bun — a newer release may understand the message type your scanner sends","Ensure the scanner writes one complete JSON document and nothing else to the IPC pipe"],"exampleFix":"// before (scanner process IPC writer)\nprocess.stdout.write(JSON.stringify({ type: \"results\", advisories }));\n\n// after\nprocess.stdout.write(JSON.stringify({ type: \"result\", advisories }));","handlingStrategy":"validation","validationCode":"// in your scanner, assert the message shape before writing to IPC\nfunction send(msg) {\n  if (msg.type !== \"error\" && msg.type !== \"result\") throw new Error(\"bad IPC type: \" + msg.type);\n  process.stdout.write(JSON.stringify(msg));\n}","typeGuard":"const isIPCMessage = (m) => m != null && (m.type === \"error\" || m.type === \"result\");","tryCatchPattern":null,"preventionTips":["Centralize IPC writing in one send() function that whitelists the type","Never write progress/log chatter to the IPC pipe — use stderr for diagnostics","Snapshot-test your scanner's emitted JSON in CI"],"tags":["security-scanner","ipc","protocol","json"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}