mastra-ai/mastra · error
Failed to list projects (${res.status})
Error message
Failed to list projects (${res.status}) What it means
The CLI failed to fetch the list of observability projects from the Mastra platform API (GET /v1/studio/projects) with a non-2xx response. The HTTP status is included in the message.
Source
Thrown at packages/cli/src/commands/init/observability-provision.ts:146
orgName,
};
// Only emit a traces endpoint override when the user is pointed at a
// non-default platform (local dev / staging). For prod, omit it so the
// MastraPlatformExporter uses its built-in https://observability.mastra.ai default.
if (MASTRA_PLATFORM_API_URL !== DEFAULT_PLATFORM_API_URL) {
result.tracesEndpoint = deriveTracesEndpoint(MASTRA_PLATFORM_API_URL, project.id);
}
return result;
}
async function listProjects(token: string, orgId: string): Promise<ObservabilityProject[]> {
const res = await platformFetch(`${MASTRA_PLATFORM_API_URL}/v1/studio/projects`, {
headers: authHeaders(token, orgId),
});
if (!res.ok) {
throw new Error(`Failed to list projects (${res.status})`);
}
const body = (await res.json()) as { projects: ObservabilityProject[] };
return body.projects;
}
async function createProject({
token,
orgId,
defaultName,
orgName,
}: {
token: string;
orgId: string;
defaultName?: string;
orgName: string;
}): Promise<ObservabilityProject> {
const name = await p.text({
message: `New project name (in ${orgName})`,View on GitHub (pinned to 75dd419e61)
Solutions
- Check the HTTP status in the message; on 401/403 re-authenticate with `mastra login` to get a fresh token.
- Verify your account has access to the organization and its projects.
- Retry if the status is 5xx (transient platform issue) and check Mastra platform status.
- Check corporate proxies/VPN blocking requests to the platform API URL.
Defensive patterns
Strategy: retry
Validate before calling
const token = await getValidPlatformToken(); // refresh via `mastra login` if expired
if (!orgId) throw new Error('orgId required before listing projects'); Try / catch
try {
const projects = await provisionObservabilityProject(...);
} catch (err) {
if (err.message.startsWith('Failed to list projects')) {
const status = err.message.match(/\((\d+)\)/)?.[1];
if (status === '401' || status === '403') await reauth();
else if (status?.startsWith('5')) await retryWithBackoff();
}
} Prevention
- Re-authenticate before long init sessions so tokens are fresh.
- Verify org membership and network/proxy access to the platform API.
- Retry transient 5xx failures with backoff.
When it happens
Trigger: provisionObservabilityProject calls listProjects and the platform API returns 401/403 (expired or invalid token), 404 (wrong org id), or 5xx.
Common situations: Expired login token requiring re-auth (`mastra login`), missing org membership, network/proxy interference, or platform outage.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Failed to create access token (${res.status})
- Perplexity Search request failed with status ${response.stat
- Failed to fetch Copilot models: ${response.status} ${respons
- AuthFailureError(authFailureStatus, error)
- Failed to create project (${res.status})
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/fbdb670ca68a91fe.
Report an issue: GitHub.