oven-sh/bun · error · Error

[azure] Failed to get public IP for ${vmName}

Error message

[azure] Failed to get public IP for ${vmName}

What it means

Thrown by the Azure VM creation flow in scripts/azure.mjs after it polls getPublicIpAddress() 30 times at 5-second intervals (~2.5 minutes) and never receives an address. It means the public IP resource was created but Azure never assigned it an ipAddress value.

Source

Thrown at scripts/azure.mjs:512

      tags: tags
        ? Object.fromEntries(
            Object.entries(tags)
              .filter(([_, v]) => v != null)
              .map(([k, v]) => [k, String(v)]),
          )
        : undefined,
    });

    // Wait for public IP to be assigned
    let publicIp;
    for (let i = 0; i < 30; i++) {
      publicIp = await getPublicIpAddress(publicIpName);
      if (publicIp) break;
      await new Promise(r => setTimeout(r, 5000));
    }

    if (!publicIp) {
      throw new Error(`[azure] Failed to get public IP for ${vmName}`);
    }

    console.log(`[azure] VM created: ${vmName} at ${publicIp}`);

    // Use Azure Run Command for all remote operations instead of SSH.
    // This avoids the sshd startup issues on Azure Windows VMs.

    const spawnFn = async (command, opts) => {
      const script = command.join(" ");
      console.log(`[azure] Run: ${script}`);
      // Note: Azure Run Command output is limited to the last 4096 bytes.
      // Full output is not available — only the tail is returned.
      // value[0] = stdout (ComponentStatus/StdOut), value[1] = stderr (ComponentStatus/StdErr)
      const result = await runCommand(vmName, [script]);
      const values = result?.value ?? [];
      const stdout = values[0]?.message ?? "";
      const stderr = values[1]?.message ?? "";
      if (opts?.stdio === "inherit") {

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Re-run the job — most assignments succeed on a fresh attempt
  2. Inspect the resource: az network public-ip show -g <resource-group> -n <ip-name> and check provisioningState/ipAddress
  3. Verify quota with az network list-usages and check Azure region health
  4. If the IP object is stuck, delete it and retry so the script creates a new one
Defensive patterns

Strategy: retry

Try / catch

try {
  await azure.create();
} catch (e) {
  if (e.message.includes("Failed to get public IP")) {
    await new Promise(r => setTimeout(r, 60_000)); // let Azure catch up
    return azure.create(); // one fresh attempt
  }
  throw e;
}

Prevention

When it happens

Trigger: createVm completes, but the attached public IP stays pending/empty — Azure provisioning delays, region capacity pressure, public-IP quota exhaustion, or a failed allocation on the IP resource.

Common situations: Transient Azure provisioning slowness in busy regions; hitting the subscription's regional public IP quota after creating/deleting many CI VMs in a short window; Azure service incidents affecting networking.

Related errors


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