oven-sh/bun · error · Error

packer build exited with ${signal ? `signal ${signal}` : `co

Error message

packer build exited with ${signal ? `signal ${signal}` : `code ${code}`}

What it means

The final gate of buildWindowsImageWithPacker(): `packer build` ran with forwarded SIGINT/SIGTERM, and after the child closed its exit code was non-zero (or it died to a signal). Packer's real error — the failing provisioner/build step — is in the output printed above this throw, not in the message itself.

Source

Thrown at scripts/machine.mjs:1313

    },
  });
  let cancelled = false;
  const forward = signal => {
    cancelled = true;
    console.log(`[packer] received ${signal}, forwarding to packer for Azure cleanup...`);
    child.kill(signal);
  };
  process.on("SIGINT", forward);
  process.on("SIGTERM", forward);
  const [code, signal] = await new Promise(done => child.on("close", (c, s) => done([c, s])));
  process.off("SIGINT", forward);
  process.off("SIGTERM", forward);
  if (cancelled) {
    console.log("[packer] cleanup after cancel finished");
    process.exit(1);
  }
  if (code !== 0) {
    throw new Error(`packer build exited with ${signal ? `signal ${signal}` : `code ${code}`}`);
  }

  console.log(`[packer] Image built successfully: ${imageDefName}`);
}

/**
 * Download and install Packer if not already available.
 */
async function ensurePacker() {
  // Check if packer is already in PATH
  const packerPath = which("packer");
  if (packerPath) {
    console.log("[packer] Found:", packerPath);
    return packerPath;
  }

  // Check if we have a local copy
  const localPacker = join(tmpdir(), "packer");

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Scroll up in the job log — packer prints the exact failing step (e.g. WinRM timeout, artifact upload) before this throw
  2. Fix the named cause: rotate creds, request quota, or fix the bootstrap script
  3. Re-run the bake: WinRM/Azure transient failures are common and often pass on retry
  4. If the message says 'signal SIGTERM/SIGINT', the job was cancelled — retrigger it
Defensive patterns

Strategy: try-catch

Validate before calling

// Fail fast before a 30+ minute bake if credentials are already bad
await getAzureToken(tenantId, clientId, clientSecret);
if (!existsSync(templateFile)) throw new Error(`missing packer template: ${templateFile}`);

Try / catch

try {
  await buildWindowsImageWithPacker(opts);
} catch (error) {
  if (/signal/i.test(String(error))) {
    // job was cancelled — retrigger instead of 'fixing' anything
  } else {
    // the real failing step is in packer's log above this throw — triage it, then retry once
  }
  throw error;
}

Prevention

When it happens

Trigger: Azure build errors: auth expiry mid-build, quota/capacity failures, WinRM connection timeouts (especially x64-on-ARM emulation slowness); packer plugin init/download failures; the job being signalled (signal appears in the message).

Common situations: Transient Azure/WinRM flakes on Windows arm64 bakes; stale AZURE_* credentials; cancelled CI jobs forwarding SIGTERM into packer.

Related errors


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