mastra-ai/mastra · error · Error

No deploys found for linked Studio project ${linkedProject.n

Error message

No deploys found for linked Studio project ${linkedProject.name}. The suggestions command helps debug failed deployments, and you can run it after a deployment fails with `mastra studio deploy suggestions <deploy-id>` or `mastra studio deploy suggestions`.

What it means

Thrown by getLatestProjectDeploy when the project linked in the Studio config has no `latestDeployId` — i.e., the linked Studio project exists but has never completed a deploy. The message also advertises the `mastra studio deploy suggestions` command for debugging failed deployments.

Source

Thrown at packages/cli/src/commands/studio/deploy-suggestions.ts:17

import * as p from '@clack/prompts';

import { withPollingRetries } from '../../utils/polling.js';
import { getCurrentOrgId, getToken, validateOrgAccess } from '../auth/credentials.js';
import { pollForDiagnosis, printDeploySuggestions } from '../deploy-suggestions.js';
import { fetchDeployDiagnosis, fetchProjects, startDeployDiagnosis } from './platform-api.js';
import type { Project } from './platform-api.js';
import { loadProjectConfig } from './project-config.js';

function getLatestProjectDeploy(projects: Project[], linkedProjectId?: string) {
  const linkedProject = linkedProjectId ? projects.find(project => project.id === linkedProjectId) : null;
  if (linkedProject) {
    if (linkedProject.latestDeployId) {
      return { deployId: linkedProject.latestDeployId, projectId: linkedProject.id, projectName: linkedProject.name };
    }

    throw new Error(
      `No deploys found for linked Studio project ${linkedProject.name}. The suggestions command helps debug failed deployments, and you can run it after a deployment fails with \`mastra studio deploy suggestions <deploy-id>\` or \`mastra studio deploy suggestions\`.`,
    );
  }

  if (linkedProjectId) {
    throw new Error(
      `Linked Studio project ${linkedProjectId} was not found in this organization. Re-link your project or pass a deploy ID explicitly.`,
    );
  }

  const latestProject = projects
    .filter(project => project.latestDeployId)
    .sort((left, right) => {
      const leftTime = left.latestDeployCreatedAt ? Date.parse(left.latestDeployCreatedAt) : 0;
      const rightTime = right.latestDeployCreatedAt ? Date.parse(right.latestDeployCreatedAt) : 0;
      return rightTime - leftTime;
    })[0];

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Run `mastra studio deploy suggestions` to debug why the deployment failed, or re-run `mastra studio deploy` to create the first deploy.
  2. Pass an explicit deploy ID to the command: `mastra studio deploy suggestions <deploy-id>`.
  3. Confirm the linked project in your config is the intended one; re-link if necessary.
  4. Check the platform dashboard — the project may show a failed first deployment with logs.

Example fix

// before
mastra studio deploy suggestions
// after
mastra studio deploy suggestions <deploy-id>
Defensive patterns

Strategy: validation

Validate before calling

const projects = await fetchProjects(token, orgId);
const linked = projects.find(p => p.id === projectConfig?.projectId);
if (linked && !linked.latestDeployId) {
  console.error(`Project ${linked.name} has no deploys yet. Run 'mastra studio deploy' first.`);
}

Try / catch

try {
  const dep = await resolveDeployId(args, ctx);
} catch (err) {
  if ((err as Error).message.includes('No deploys found for linked Studio project')) {
    console.error('Deploy the project first: `mastra studio deploy` (or pass a deploy ID).');
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `mastra studio deploy suggestions` (or any command resolving the latest deploy) when projectConfig.projectId links to a real project whose latestDeployId is null/undefined — typically because the project was created but its first deployment never ran or never succeeded.

Common situations: Linking a brand-new Studio project before the first deploy; the very first deploy failing so no deploy ID is recorded; organization switches leaving a stale link to an empty project.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/784fa0c5fb555929. Report an issue: GitHub.