oven-sh/bun · error · Error

Dockerfile not found: ${dockerfilePath}

Error message

Dockerfile not found: ${dockerfilePath}

What it means

When the requested features include 'docker', machine.mjs requires the repo's Dockerfile at ../.buildkite/Dockerfile (resolved relative to the script's own directory) and throws if it is missing. The absolute path is printed in the message.

Source

Thrown at scripts/machine.mjs:1491

    if (!existsSync(bootstrapPath)) {
      throw new Error(`Script not found: ${bootstrapPath}`);
    }
    if (ci) {
      const npx = which("bunx") || which("npx");
      if (!npx) {
        throw new Error("Executable not found: bunx or npx");
      }
      const entryPath = resolve(import.meta.dirname, "agent.mjs");
      const tmpPath = mkdtempSync(join(tmpdir(), "agent-"));
      agentPath = join(tmpPath, "agent.mjs");
      await spawnSafe($`${npx} esbuild ${entryPath} --bundle --platform=node --format=esm --outfile=${agentPath}`);
    }

    if (features?.includes("docker")) {
      dockerfilePath = resolve(import.meta.dirname, "../.buildkite/Dockerfile");

      if (!existsSync(dockerfilePath)) {
        throw new Error(`Dockerfile not found: ${dockerfilePath}`);
      }
    }
  }

  // Use Packer for Windows Azure image builds — it handles VM creation,
  // bootstrap, sysprep, and gallery capture via WinRM (no Run Command hacks).
  if (args["cloud"] === "azure" && os === "windows" && (command === "create-image" || command === "publish-image")) {
    await buildWindowsImageWithPacker({ os, arch, release, command, ci, agentPath, bootstrapPath });
    return;
  }

  /** @type {Machine} */
  const machine = await startGroup("Creating machine...", async () => {
    console.log("Creating machine:");
    console.table({
      "Operating System": os,
      "Architecture": arch,
      "Distribution": distro ? `${distro} ${release}` : release,

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Check the path from the error message with `ls`
  2. Restore it: `git restore .buildkite/Dockerfile` (or merge upstream if it moved)
  3. Omit the docker feature if this run does not need a Docker-equipped machine
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from "node:fs";

const dockerfilePath = new URL("../.buildkite/Dockerfile", import.meta.url);
if (features.includes("docker") && !existsSync(dockerfilePath)) {
  throw new Error("docker feature requested but .buildkite/Dockerfile is absent from this checkout");
}

Prevention

When it happens

Trigger: Requesting the docker feature in a checkout that lacks the .buildkite directory — sparse checkouts, moved script copies, or after the Dockerfile was renamed upstream while your branch predates it.

Common situations: Sparse CI checkout excluding .buildkite/; running a fork where the Dockerfile was deleted; branch drift after build infrastructure files moved.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/e0b890ef385e88c6. Report an issue: GitHub.