{"record":{"id":"3603b1b85be03a45","repo":"oven-sh/bun","slug":"azure-operation-timed-out-after-maxwaitms-ms","errorCode":null,"errorMessage":"[azure] Operation timed out after ${maxWaitMs}ms","messagePattern":"\\[azure\\] Operation timed out after (.+?)ms","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/azure.mjs","lineNumber":184,"sourceCode":"    }\n\n    if (!response.ok) {\n      throw new Error(`[azure] Operation poll failed: ${response.status} ${await response.text()}`);\n    }\n\n    const data = await response.json();\n\n    if (data.status === \"Succeeded\") {\n      return data.properties?.output ?? data;\n    }\n    if (data.status === \"Failed\" || data.status === \"Canceled\") {\n      throw new Error(`[azure] Operation ${data.status}: ${data.error?.message ?? \"unknown\"}`);\n    }\n\n    await new Promise(r => setTimeout(r, 5000));\n  }\n\n  throw new Error(`[azure] Operation timed out after ${maxWaitMs}ms`);\n}\n\n// ============================================================================\n// Resource helpers\n// ============================================================================\n\nfunction rgPath() {\n  const { subscriptionId, resourceGroup } = config();\n  return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}`;\n}\n\n// ============================================================================\n// Public IP\n// ============================================================================\n\nasync function createPublicIp(name) {\n  const { location } = config();\n  console.log(`[azure] Creating public IP: ${name}`);","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/azure.mjs#L166-L202","documentation":"waitForOperation() polled the Azure async operation every 5 seconds but it never reached Succeeded/Failed/Canceled within maxWaitMs (default 3_600_000 ms = 1 hour). The operation is still officially in progress; the script simply stopped waiting.","triggerScenarios":"Very slow operations: image version replication across many regions, large disk/VM operations; Azure throttling the poll loop; an operation genuinely stuck in a non-terminal state.","commonSituations":"SIG/VM image replication target lists grew past an hour; Azure degradation slowing provisioning; default maxWaitMs no longer matching the workload.","solutions":["Check the operation status in the Azure portal — it may still succeed; re-run only the wait, not the operation","Pass a larger maxWaitMs to waitForOperation for replication-heavy operations","Reduce the operation's scope (fewer target regions) to fit the window","If status is stuck, cancel and resubmit the operation"],"exampleFix":"// before\nawait waitForOperation(operationUrl); // default 1h cap\n\n// after\nawait waitForOperation(operationUrl, 7_200_000); // 2h for multi-region replication","handlingStrategy":"retry","validationCode":"null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Size maxWaitMs to the operation: multi-region image replication needs well over the 1h default","Check the operation in the portal before resubmitting — it often still succeeds","Alert on near-timeout polls so slow operations are caught before the cap"],"tags":["azure","timeout","long-running-operation","polling"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}