mastra-ai/mastra · error · Error
No previous studio deploy found. Pass a deploy ID or deploy
Error message
No previous studio deploy found. Pass a deploy ID or deploy first.
What it means
Thrown by resolveDeployId when no deploy could be resolved at all: the project is not linked (so no project lookup was performed) and the fetched projects for the organization yielded no latest deploy. It instructs the user to pass a deploy ID explicitly or deploy first.
Source
Thrown at packages/cli/src/commands/studio/deploy-suggestions.ts:59
}
async function resolveDeployId(
token: string,
orgId: string,
deployId?: string,
): Promise<{ deployId: string; projectId?: string }> {
if (deployId) {
return { deployId };
}
const projectConfig = await loadProjectConfig(process.cwd());
const latestDeploy = getLatestProjectDeploy(
(await fetchProjects(token, orgId)).filter(project => project.organizationId === orgId),
projectConfig?.organizationId === orgId ? projectConfig.projectId : undefined,
);
if (!latestDeploy) {
throw new Error('No previous studio deploy found. Pass a deploy ID or deploy first.');
}
p.log.info(
`Using latest deploy: ${latestDeploy.deployId}${latestDeploy.projectName ? ` (${latestDeploy.projectName})` : ''}`,
);
return { deployId: latestDeploy.deployId, projectId: latestDeploy.projectId };
}
export async function suggestionsAction(deployId?: string) {
p.intro('mastra studio deploy suggestions');
try {
const token = await getToken();
const orgId = await getCurrentOrgId();
if (!orgId) {
p.log.error('No organization selected. Run: mastra auth login');
process.exit(1);
}View on GitHub (pinned to 75dd419e61)
Solutions
- Run `mastra studio deploy` first to create a deployment, then retry the command.
- Pass an explicit deploy ID: `mastra studio deploy suggestions <deploy-id>`.
- Link your Studio project in the config so the resolver can find its deploys.
- Confirm your CLI auth targets the organization that actually has deployments.
Example fix
// before mastra studio deploy suggestions // after mastra studio deploy && mastra studio deploy suggestions
Defensive patterns
Strategy: validation
Validate before calling
const projects = await fetchProjects(token, orgId);
const anyDeploy = projects.some(p => p.latestDeployId);
if (!projectConfig?.projectId && !anyDeploy && !args.deployId) {
console.error(`Org ${orgId} has no deploys. Run 'mastra studio deploy' first or pass a deploy ID.`);
} Try / catch
try {
const dep = await resolveDeployId(args, ctx);
} catch (err) {
if ((err as Error).message.includes('No previous studio deploy found')) {
console.error('Nothing deployed yet — run `mastra studio deploy` or provide a deploy ID.');
return;
}
throw err;
} Prevention
- Deploy at least once before running deploy-suggestions/logs commands.
- Link your project so the resolver can find its deploys automatically.
- Pass the deploy ID explicitly in scripts and CI to avoid resolution entirely.
- Confirm you're authenticated to the organization containing your deployments.
When it happens
Trigger: Running `mastra studio deploy suggestions` with no deploy ID argument, no linked project in config, and no project in the organization having a latestDeployId — effectively a fresh organization or one where nothing has been deployed yet.
Common situations: Fresh account/org with zero deployments; running suggestions before ever running `mastra studio deploy`; authentication scoped to an organization different from where deploys live.
Related errors
- No deploys found for linked Studio project ${linkedProject.n
- You have no organizations. Please create one at ${MASTRA_STU
- Found ${projects.length} existing project(s) in this organiz
- Could not determine project name from package.json. Use --pr
- .mastra/output/index.mjs not found — did the build succeed?
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/5d78cfc1564995c8.
Report an issue: GitHub.