{"record":{"id":"e326bb9a7539d71b","repo":"mastra-ai/mastra","slug":"diagnosis-polling-timed-out-after-5-minutes-pleas","errorCode":null,"errorMessage":"Diagnosis polling timed out after 5 minutes. Please try again later.","messagePattern":"Diagnosis polling timed out after 5 minutes\\. Please try again later\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/deploy-suggestions.ts","lineNumber":104,"sourceCode":"  const spinner = p.spinner();\n  spinner.start(pc.cyan('Diagnosing deploy failure'));\n  const deadline = Date.now() + POLL_TIMEOUT_MS;\n\n  try {\n    while (true) {\n      const result = await withPollingRetries(fetchDiagnosis);\n      if (result.state === 'healthy') {\n        spinner.stop(pc.green('Deploy is healthy'));\n        return result;\n      }\n\n      if (result.state === 'ready' && result.diagnosis.status !== 'PENDING') {\n        spinner.stop(pc.green('Diagnosis complete'));\n        return result;\n      }\n\n      if (Date.now() >= deadline) {\n        throw new Error('Diagnosis polling timed out after 5 minutes. Please try again later.');\n      }\n\n      await new Promise(resolve => setTimeout(resolve, 1000));\n    }\n  } catch (error) {\n    spinner.stop(pc.red('Diagnosis failed'));\n    throw error;\n  }\n}\n","sourceCodeStart":86,"sourceCodeEnd":114,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/cli/src/commands/deploy-suggestions.ts#L86-L114","documentation":"`mastra deploy` failed and the CLI polls the platform for an AI-generated diagnosis of the failure (pollForDiagnosis in deploy-suggestions.ts). If the diagnosis stays PENDING for more than 5 minutes (POLL_TIMEOUT_MS), the CLI gives up and throws this error so the user can retry later instead of hanging forever.","triggerScenarios":"A deploy fails, `pollForDiagnosis` starts polling the diagnosis endpoint every 1s (with transient-error retries via withPollingRetries), and every response is still state 'ready' with diagnosis.status 'PENDING' until Date.now() >= deadline (5 minutes).","commonSituations":"Platform-side diagnosis generation is slow, degraded, or queued behind load right after a deploy outage; network/proxy setups that keep returning PENDING or stall the backend worker; very large deploy logs taking long to analyze.","solutions":["Retry the command later — the diagnosis may finish generating once platform load subsides.","Inspect the raw deploy logs directly at the printed logs URL (default https://projects.mastra.ai) instead of relying on the diagnosis.","Check platform status/incidents if diagnoses consistently time out; report if PENDING never resolves."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Skip diagnosing when you already know the platform is degraded:\nif (process.env.MASTRA_PLATFORM_DEGRADED === '1') {\n  console.log('Skipping diagnosis poll; read deploy logs directly at the logs URL.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const diagnosis = await pollForDiagnosis(fetchDiagnosis);\n} catch (error) {\n  if (error instanceof Error && error.message.includes('timed out')) {\n    // fall back to raw deploy logs instead of blocking the user\n    console.log('Diagnosis unavailable right now — open the deploy logs URL to inspect the failure.');\n  } else {\n    throw error;\n  }\n}","preventionTips":["Bookmark the deploy logs URL so a diagnosis timeout never blocks debugging.","Retry during platform off-peak hours if diagnoses consistently time out.","Monitor platform status pages before relying on AI diagnosis during incident windows.","Keep a local copy of deploy logs (they contain the root cause the diagnosis summarizes)."],"tags":["network","timeout","polling","deployment"],"backgroundTag":"polling-timeout","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}