mastra-ai/mastra · error
Deploy timed out
Error message
Deploy timed out
What it means
pollServerDeploy GETs the deploy status every 5s until a terminal status (running/failed/crashed/cancelled/stopped) is observed or maxWaitMs (default 10 minutes) elapses. If the window expires while the deploy is still building/deploying, it throws 'Deploy timed out' — note the deploy may still succeed server-side afterwards.
Source
Thrown at packages/cli/src/commands/server/platform-api.ts:241
client = createApiClient(currentToken, orgId);
continue;
}
throwApiError('Poll failed', response.status);
}
if (data.status !== lastStatus) {
lastStatus = data.status;
}
const terminal = ['running', 'failed', 'crashed', 'cancelled', 'stopped'];
if (terminal.includes(data.status)) {
return data;
}
await new Promise(r => setTimeout(r, 5000));
}
throw new Error('Deploy timed out');
} finally {
logAbort.abort();
}
}
/* ------------------------------------------------------------------ */
/* Environment variables */
/* ------------------------------------------------------------------ */
export async function getServerProjectEnv(
token: string,
orgId: string,
projectId: string,
): Promise<Record<string, string>> {
const client = createApiClient(token, orgId);
const { data, error, response } = await client.GET('/v1/server/projects/{id}/env', {
params: { path: { id: projectId } },
});View on GitHub (pinned to 75dd419e61)
Solutions
- Re-run the deploy — or first check the deploy's status in the dashboard; it may have completed after the CLI gave up
- Increase the poll budget by invoking the deploy with a longer maxWaitMs if using the API programmatically
- Shrink build time (cache dependencies, smaller artifact) to fit the 10-minute window
- Check platform status/incidents for build-queue backlogs before retrying
Example fix
// before await pollServerDeploy(deployId, token, orgId); // default 10 min // after await pollServerDeploy(deployId, token, orgId, 30 * 60 * 1000); // 30 min
Defensive patterns
Strategy: retry
Validate before calling
// Before deploying, estimate build time budget in CI and warn if the platform has known slow builds
if (process.env.SLOW_BUILD === 'true') {
console.warn('Expected build >10min — invoke pollServerDeploy with a larger maxWaitMs or poll the dashboard.');
} Try / catch
const TIMEOUT = /Deploy timed out/;
try {
await deploy();
} catch (err) {
if (err instanceof Error && TIMEOUT.test(err.message)) {
// Deploy may still finish server-side: poll status instead of immediately redeploying
const status = await getDeployStatus(deployId);
if (!['failed', 'crashed', 'cancelled'].includes(status)) return; // succeeded late
throw err;
}
throw err;
} Prevention
- Cache dependencies and keep builds under the 10-minute default window
- Use a longer maxWaitMs for known-slow builds (API is parameterized)
- Check the dashboard before retrying — the deploy may complete after timeout
- Watch platform status for build-queue incidents before large deploys
When it happens
Trigger: Platform build takes longer than 10 minutes (large dependency tree, slow image builds); polling endpoint continuously slow/erroring and retries eating the budget; deploy stuck in a non-terminal state due to platform-side queue backlog or hang.
Common situations: Cold monorepo builds with heavy installs; platform incidents where builds queue for many minutes; deploys of unusually large artifacts causing long build phases.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Timed out waiting for database to become ready (last status:
- Deploy timed out
- Diagnosis polling timed out after 5 minutes. Please try agai
- Deploy timed out
- State token has expired
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/b5b24475487ebaac.
Report an issue: GitHub.