{"record":{"id":"ca1fbb946b7a6964","repo":"oven-sh/bun","slug":"script-not-found-bootstrappath","errorCode":null,"errorMessage":"Script not found: ${bootstrapPath}","messagePattern":"Script not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/machine.mjs","lineNumber":1474,"sourceCode":"    name += `-musl`;\n  }\n\n  if (features?.length) {\n    name += `-with-${features.join(\"-\")}`;\n  }\n\n  let bootstrapPath, agentPath, dockerfilePath;\n  if (bootstrap) {\n    bootstrapPath = resolve(\n      import.meta.dirname,\n      os === \"windows\"\n        ? \"bootstrap.ps1\"\n        : features?.includes(\"docker\")\n          ? \"../.buildkite/Dockerfile-bootstrap.sh\"\n          : \"bootstrap.sh\",\n    );\n    if (!existsSync(bootstrapPath)) {\n      throw new Error(`Script not found: ${bootstrapPath}`);\n    }\n    if (ci) {\n      const npx = which(\"bunx\") || which(\"npx\");\n      if (!npx) {\n        throw new Error(\"Executable not found: bunx or npx\");\n      }\n      const entryPath = resolve(import.meta.dirname, \"agent.mjs\");\n      const tmpPath = mkdtempSync(join(tmpdir(), \"agent-\"));\n      agentPath = join(tmpPath, \"agent.mjs\");\n      await spawnSafe($`${npx} esbuild ${entryPath} --bundle --platform=node --format=esm --outfile=${agentPath}`);\n    }\n\n    if (features?.includes(\"docker\")) {\n      dockerfilePath = resolve(import.meta.dirname, \"../.buildkite/Dockerfile\");\n\n      if (!existsSync(dockerfilePath)) {\n        throw new Error(`Dockerfile not found: ${dockerfilePath}`);\n      }","sourceCodeStart":1456,"sourceCodeEnd":1492,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/machine.mjs#L1456-L1492","documentation":"When the bootstrap option is set, machine.mjs resolves a bootstrap script next to itself — bootstrap.ps1 on Windows, ../.buildkite/Dockerfile-bootstrap.sh when the docker feature is on, otherwise bootstrap.sh — and throws if existsSync fails. The resolved absolute path is included in the message.","triggerScenarios":"Passing the bootstrap flag in a checkout where the target file was deleted, moved, or never checked out (sparse checkout / partial archive of the repo), or running a copied machine.mjs without its sibling scripts.","commonSituations":"Sparse CI checkout that excludes scripts/bootstrap.sh; a stale branch after the bootstrap files were reorganized into .buildkite/; running the script from an extracted tarball of only part of the repo.","solutions":["Inspect the exact path in the error message and check whether it exists (`ls` it)","Restore the file in git: `git restore scripts/bootstrap.sh` (or `.buildkite/Dockerfile-bootstrap.sh`)","Run from a full clone of the repository so the relative resolution from import.meta.dirname works","Drop the bootstrap option if you do not need a bootstrapped machine"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nimport { resolve, dirname } from \"node:path\";\n\nconst scriptDir = dirname(fileURLToPath(import.meta.url));\nconst candidates = [\n  resolve(scriptDir, \"bootstrap.sh\"),\n  resolve(scriptDir, \"bootstrap.ps1\"),\n  resolve(scriptDir, \"../.buildkite/Dockerfile-bootstrap.sh\"),\n];\nif (bootstrapRequested && !candidates.some(existsSync)) {\n  throw new Error(\"Bootstrap scripts missing — run from a full checkout\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run machine.mjs from a complete clone; avoid sparse checkouts that drop scripts/ or .buildkite/","In CI, add a checkout-integrity step listing required files before invoking machine tasks"],"tags":["filesystem","bootstrap","cli","checkout"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}