{"record":{"id":"691609069d7a9d18","repo":"mastra-ai/mastra","slug":"deploy-timed-out-691609","errorCode":null,"errorMessage":"Deploy timed out","messagePattern":"Deploy timed out","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/studio/platform-api.ts","lineNumber":304,"sourceCode":"          continue;\n        }\n        throwApiError('Poll failed', response.status, error.detail);\n      }\n\n      const { deploy } = data;\n\n      if (deploy.status !== lastStatus) {\n        lastStatus = deploy.status;\n      }\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","sourceCodeStart":286,"sourceCodeEnd":309,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/cli/src/commands/studio/platform-api.ts#L286-L309","documentation":"pollDeploy polls the deploy status every 2 seconds until the deploy reaches a terminal state or the timeout budget is exhausted. When the loop ends without a terminal status, it throws 'Deploy timed out'. The abort signal is cleaned up in finally.","triggerScenarios":"The deploy record never reaches a terminal (success/failed) status within the polling window — long builds server-side, deploy stuck in 'building'/'uploading' due to a backend incident, or the poll loop's deadline being shorter than the deploy actually needs.","commonSituations":"Very large projects whose remote build exceeds the CLI's default timeout; API degradation where status polling returns stale data; CI jobs killed by outer timeouts interacting with this one; network flakiness making each poll slow so the wall-clock budget runs out.","solutions":["Check the deploy's status in the Mastra Studio UI — it may have completed after the CLI gave up","Re-run `mastra studio deploy`; the platform deduplicates/reuses the deploy when appropriate","Reduce artifact size / build time so the deploy finishes within the polling budget","Check Mastra status/changelog for incidents causing stuck deploys","If the CLI exposes timeout env/config (e.g. MASTRA_SKIP_PREFLIGHT-style flags, debug logs), raise the deadline or file an issue for a --timeout flag"],"exampleFix":"// before\nmastra studio deploy --yes\n// Error: Deploy timed out  (deploy actually finished in Studio UI)\n// after: verify in Studio, then re-run or monitor there\nmastra studio deploy --yes  # after backend incident resolved","handlingStrategy":"retry","validationCode":"const deadline = Date.now() + 15 * 60 * 1000;\nconst status = await getDeployStatus(deployId);\nif (isTerminal(status) === false && Date.now() > deadline) {\n  console.warn('Deploy still in progress; check Studio UI before re-deploying.');\n}","typeGuard":"function isTerminal(d: { status: string }): boolean {\n  return ['succeeded', 'failed', 'canceled'].includes(d.status);\n}","tryCatchPattern":"try {\n  await pollDeploy(client, deployId);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Deploy timed out') {\n    const latest = await getDeployStatus(deployId);\n    console.error(`CLI polling timed out; current server status: ${latest.status}. Check the Studio UI.`);\n    process.exitCode = 4;\n  } else throw e;\n}","preventionTips":["Check the deploy status in Studio UI before blindly re-running after a timeout","Keep builds/artifacts small so deploys finish within the polling budget","Retry the deploy once after confirming no backend incident","Monitor Mastra status for stuck-deploy incidents","Wrap outer CI timeouts larger than the deploy polling window"],"tags":["network","timeout","polling"],"backgroundTag":"deploy-timeout","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}