{"record":{"id":"48c94312c8c3348f","repo":"oven-sh/bun","slug":"command-not-found-description","errorCode":null,"errorMessage":"Command not found: ${description}","messagePattern":"Command not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/utils.mjs","lineNumber":1044,"sourceCode":"export function which(command, options = {}) {\n  const commands = Array.isArray(command) ? command : [command];\n  const executables = isWindows ? commands.flatMap(name => [name, `${name}.exe`, `${name}.cmd`]) : commands;\n\n  const path = getEnv(\"PATH\", false) || \"\";\n  const binPaths = path.split(isWindows ? \";\" : \":\");\n\n  for (const binPath of binPaths) {\n    for (const executable of executables) {\n      const executablePath = join(binPath, executable);\n      if (existsSync(executablePath)) {\n        return executablePath;\n      }\n    }\n  }\n\n  if (options[\"required\"]) {\n    const description = commands.join(\" or \");\n    throw new Error(`Command not found: ${description}`);\n  }\n}\n\n/**\n * @returns {string | undefined}\n */\nexport function getBuildId() {\n  if (isBuildkite) {\n    return getEnv(\"BUILDKITE_BUILD_ID\");\n  }\n\n  if (isGithubAction) {\n    return getEnv(\"GITHUB_RUN_ID\");\n  }\n}\n\n/**\n * @returns {number | undefined}","sourceCodeStart":1026,"sourceCodeEnd":1062,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/utils.mjs#L1026-L1062","documentation":"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.","triggerScenarios":"Thrown at scripts/utils.mjs:1044 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the missing command or add it to PATH","Pass required=false and handle undefined if the tool is optional"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"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"}