oven-sh/bun · error · Error

[azure] Operation poll failed after ${fetchErrors} fetch err

Error message

[azure] Operation poll failed after ${fetchErrors} fetch errors

What it means

While polling an Azure long-running operation URL, the raw fetch itself (network layer) threw more than 10 times, with a 10-second pause between tries. The original network error is attached as { cause }. This is a connectivity/DNS/egress failure sustained over ~100 seconds, not an Azure API rejection.

Source

Thrown at scripts/azure.mjs:161

  throw new Error(`[azure] ${method} ${path} failed after 3 retries`);
}

async function waitForOperation(operationUrl, maxWaitMs = 3_600_000) {
  const start = Date.now();
  let fetchErrors = 0;

  while (Date.now() - start < maxWaitMs) {
    const token = await getAccessToken();

    let response;
    try {
      response = await fetch(operationUrl, {
        headers: { Authorization: `Bearer ${token}` },
      });
    } catch (err) {
      fetchErrors++;
      if (fetchErrors > 10) {
        throw new Error(`[azure] Operation poll failed after ${fetchErrors} fetch errors`, { cause: err });
      }
      console.warn(`[azure] Operation poll fetch error (${fetchErrors}), retrying...`);
      await new Promise(r => setTimeout(r, 10_000));
      continue;
    }

    if (!response.ok) {
      throw new Error(`[azure] Operation poll failed: ${response.status} ${await response.text()}`);
    }

    const data = await response.json();

    if (data.status === "Succeeded") {
      return data.properties?.output ?? data;
    }
    if (data.status === "Failed" || data.status === "Canceled") {
      throw new Error(`[azure] Operation ${data.status}: ${data.error?.message ?? "unknown"}`);
    }

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Check the cause in the error/stack — ECONNRESET, ENOTFOUND, ETIMEDOUT each point differently
  2. Verify egress to the operation URL host from the runner (curl it)
  3. Fix proxy/DNS config on the runner and retry the job
  4. Re-run once network is restored; the operation may still complete server-side

Example fix

// before
catch (err) {
  fetchErrors++;
  if (fetchErrors > 10) throw new Error(`[azure] Operation poll failed after ${fetchErrors} fetch errors`, { cause: err });
}

// after
catch (err) {
  fetchErrors++;
  console.error(`poll network error ${fetchErrors}:`, err.code ?? err.message);
  if (fetchErrors > 10) throw new Error(`[azure] Operation poll failed after ${fetchErrors} fetch errors`, { cause: err });
}
Defensive patterns

Strategy: retry

Validate before calling

null

Prevention

When it happens

Trigger: CI runner lost network egress; DNS resolution broken; a proxy/firewall drops connections to management.azure.com; TLS interception failing intermittently.

Common situations: Self-hosted runner behind a corporate proxy; transient VPC/network policy change mid-build; DNS outage in the CI cloud.

Related errors


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