oven-sh/bun · error · Error
Expected packages to be an array
Error message
Expected packages to be an array
What it means
Error "Expected packages to be an array" thrown in oven-sh/bun.
Source
Thrown at src/install/PackageManager/scanner-entry.ts:50
// Read packages JSON from fd 4 (reads until EOF when parent closes the pipe)
let packages: Bun.Security.Package[];
let packagesJson: string = "";
try {
packagesJson = await Bun.file(IPC_INPUT_FD).text();
} catch (error) {
const message = `Failed to read packages from FD ${IPC_INPUT_FD}: ${error instanceof Error ? error.message : String(error)}`;
sendAndExit({
type: "error",
code: "SCAN_FAILED",
message,
});
}
try {
packages = JSON.parse(packagesJson);
if (!Array.isArray(packages)) {
throw new Error("Expected packages to be an array");
}
} catch (error) {
const message = `Failed to parse packages JSON: ${error instanceof Error ? error.message : String(error)}`;
sendAndExit({
type: "error",
code: "SCAN_FAILED",
message,
});
}
let scanner: Bun.Security.Scanner;
try {
scanner = (await import(scannerModuleName)).scanner;
} catch (error) {
if (typeof error === "object" && error !== null && "code" in error && error.code === "ERR_MODULE_NOT_FOUND") {
if (!suppressError) {
const msg = `\x1b[31merror: \x1b[0mFailed to import security scanner: \x1b[1m'${scannerModuleName}'`;View on GitHub (pinned to 8c5296ac45)
When it happens
Trigger: Thrown at src/install/PackageManager/scanner-entry.ts:50 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/bf59d2a9dec1197b.
Report an issue: GitHub.