{"record":{"id":"ba5fc4f7b3516abd","repo":"mastra-ai/mastra","slug":"deploy-timed-out","errorCode":null,"errorMessage":"Deploy timed out","messagePattern":"Deploy timed out","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/deploy/index.ts","lineNumber":522,"sourceCode":"        await new Promise(r => setTimeout(r, 2000));\n        continue;\n      }\n\n      if (!resp.ok) {\n        const err = (await resp.json().catch(() => ({}))) as { detail?: string };\n        throw new Error(`Poll failed: ${err.detail || resp.statusText}`);\n      }\n\n      const { deploy } = (await resp.json()) as { deploy: UnifiedDeployStatus };\n\n      if (deploy.status === 'running' || deploy.status === 'failed' || deploy.status === 'stopped') {\n        return deploy;\n      }\n\n      await new Promise(r => setTimeout(r, 2000));\n    }\n\n    throw new Error('Deploy timed out');\n  } finally {\n    logAbort.abort();\n  }\n}\n\n/* ------------------------------------------------------------------ */\n/*  Main unified deploy action                                        */\n/* ------------------------------------------------------------------ */\n\nexport interface DeployOptions {\n  env?: string;\n  org?: string;\n  project?: string;\n  yes?: boolean;\n  config?: string;\n  skipBuild?: boolean;\n  skipPreflight?: boolean;\n  region?: string;","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/cli/src/commands/deploy/index.ts#L504-L540","documentation":"Thrown by pollEnvironmentDeploy when the polling loop exhausts its iteration limit before the deploy reaches a terminal status (succeeded/failed/stopped). The CLI polls every 2 seconds up to a fixed number of iterations; if the remote deploy is still 'running' after that window, it gives up with this error. It indicates the deploy exceeded the CLI's timeout, not that the deploy definitively failed.","triggerScenarios":"The deploy status remains 'running' after every 2-second poll until the loop's max iterations are consumed; then `throw new Error('Deploy timed out')` executes. An abort via logAbort exits through the finally block instead.","commonSituations":"Very large deployments (huge build artifacts, slow image builds) exceeding the CLI poll window; regional API slowdowns delaying status updates; a stuck deploy on the platform side that never transitions out of 'running'.","solutions":["Re-run the deploy; if it genuinely timed out on the platform, a new deploy attempt is needed.","Check the deploy status in the Mastra dashboard/API — the deploy may have completed after the CLI stopped polling.","Reduce deployment size or build artifact so the deploy finishes within the CLI timeout.","Check platform status/health for incidents causing slow deploys; if persistent, report a stuck deploy."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const status = await pollEnvironmentDeploy(...);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Deploy timed out') {\n    // re-check deploy status via API before assuming failure\n  } else throw e;\n}","preventionTips":["Keep build artifacts small so deploys finish within the CLI timeout.","After a timeout, query the deploy status via the dashboard/API before retrying — the deploy may have completed.","Watch for platform incidents that slow deploys.","Retry once with a fresh deploy if the status remains stuck in 'running'."],"tags":["timeout","deploy","polling"],"backgroundTag":"deploy-timeout","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}