oven-sh/bun · error
Command not found
Error message
Command not found: ${description} What it means
Thrown by the which() helper when a required command was not found on any PATH entry (with .exe/.cmd variants tried on Windows). It means the build/CI environment is missing a tool the script depends on.
Solutions
- Install the missing command or add it to PATH
- Pass required=false and handle undefined if the tool is optional
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at scripts/utils.mjs:1044 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/48c94312c8c3348f.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/utils.mjs:1044
export function which(command, options = {}) {
const commands = Array.isArray(command) ? command : [command];
const executables = isWindows ? commands.flatMap(name => [name, `${name}.exe`, `${name}.cmd`]) : commands;
const path = getEnv("PATH", false) || "";
const binPaths = path.split(isWindows ? ";" : ":");
for (const binPath of binPaths) {
for (const executable of executables) {
const executablePath = join(binPath, executable);
if (existsSync(executablePath)) {
return executablePath;
}
}
}
if (options["required"]) {
const description = commands.join(" or ");
throw new Error(`Command not found: ${description}`);
}
}
/**
* @returns {string | undefined}
*/
export function getBuildId() {
if (isBuildkite) {
return getEnv("BUILDKITE_BUILD_ID");
}
if (isGithubAction) {
return getEnv("GITHUB_RUN_ID");
}
}
/**
* @returns {number | undefined}View on GitHub (pinned to 8c5296ac45)