{"record":{"id":"a969b94efb6c845a","repo":"oven-sh/bun","slug":"azure-operation-data-status-data-error-me","errorCode":null,"errorMessage":"[azure] Operation ${data.status}: ${data.error?.message ?? \"unknown\"}","messagePattern":"\\[azure\\] Operation (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/azure.mjs","lineNumber":178,"sourceCode":"      if (fetchErrors > 10) {\n        throw new Error(`[azure] Operation poll failed after ${fetchErrors} fetch errors`, { cause: err });\n      }\n      console.warn(`[azure] Operation poll fetch error (${fetchErrors}), retrying...`);\n      await new Promise(r => setTimeout(r, 10_000));\n      continue;\n    }\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// ============================================================================","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/azure.mjs#L160-L196","documentation":"The polled long-running operation reported a terminal status of 'Failed' or 'Canceled'; Azure's own data.error.message (or 'unknown') is included. The HTTP layer was fine — the underlying Azure operation itself (e.g. an image build or VM deallocation) failed or was canceled on Azure's side.","triggerScenarios":"Image build/replication failing inside Azure (source blob missing, region capacity, gallery quota); someone canceled the operation in the portal or via another client; validation failing server-side after acceptance.","commonSituations":"Shared Image Gallery quota or replication issues; stale source resource referenced by the operation; concurrent pipelines canceling each other's operations.","solutions":["Read data.error.message in the error text — it names the Azure sub-failure","Check the operation/resource in the Azure portal (Activity Log) for the same correlation","Fix the root cause (quotas, source blob, region) and re-submit the operation","If 'Canceled', find what canceled it before resubmitting"],"exampleFix":"// before\nif (data.status === 'Failed' || data.status === 'Canceled') {\n  throw new Error(`[azure] Operation ${data.status}: ${data.error?.message ?? 'unknown'}`);\n}\n\n// after\nif (data.status === 'Failed' || data.status === 'Canceled') {\n  throw new Error(`[azure] Operation ${data.status}: ${data.error?.message ?? 'unknown'} (code=${data.error?.code ?? 'n/a'})`);\n}","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try {\n  await waitForOperation(operationUrl);\n} catch (err) {\n  if (/Operation (Failed|Canceled)/.test(err.message)) {\n    core.error(`Azure operation ended badly: ${err.message}`);\n    await collectDiagnostics(); // activity log, gallery replication status\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Read data.error.code/message first — the root cause is Azure-side, not client-side","Pre-validate operation inputs (source blobs exist, quotas, target regions) before submitting","Prevent concurrent pipelines from canceling each other's operations"],"tags":["azure","long-running-operation","provisioning"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}