{"record":{"id":"fbdb670ca68a91fe","repo":"mastra-ai/mastra","slug":"failed-to-list-projects-res-status","errorCode":null,"errorMessage":"Failed to list projects (${res.status})","messagePattern":"Failed to list projects \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/init/observability-provision.ts","lineNumber":146,"sourceCode":"    orgName,\n  };\n\n  // Only emit a traces endpoint override when the user is pointed at a\n  // non-default platform (local dev / staging). For prod, omit it so the\n  // MastraPlatformExporter uses its built-in https://observability.mastra.ai default.\n  if (MASTRA_PLATFORM_API_URL !== DEFAULT_PLATFORM_API_URL) {\n    result.tracesEndpoint = deriveTracesEndpoint(MASTRA_PLATFORM_API_URL, project.id);\n  }\n\n  return result;\n}\n\nasync function listProjects(token: string, orgId: string): Promise<ObservabilityProject[]> {\n  const res = await platformFetch(`${MASTRA_PLATFORM_API_URL}/v1/studio/projects`, {\n    headers: authHeaders(token, orgId),\n  });\n  if (!res.ok) {\n    throw new Error(`Failed to list projects (${res.status})`);\n  }\n  const body = (await res.json()) as { projects: ObservabilityProject[] };\n  return body.projects;\n}\n\nasync function createProject({\n  token,\n  orgId,\n  defaultName,\n  orgName,\n}: {\n  token: string;\n  orgId: string;\n  defaultName?: string;\n  orgName: string;\n}): Promise<ObservabilityProject> {\n  const name = await p.text({\n    message: `New project name (in ${orgName})`,","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/cli/src/commands/init/observability-provision.ts#L128-L164","documentation":"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.","triggerScenarios":"provisionObservabilityProject calls listProjects and the platform API returns 401/403 (expired or invalid token), 404 (wrong org id), or 5xx.","commonSituations":"Expired login token requiring re-auth (`mastra login`), missing org membership, network/proxy interference, or platform outage.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const token = await getValidPlatformToken(); // refresh via `mastra login` if expired\nif (!orgId) throw new Error('orgId required before listing projects');","typeGuard":null,"tryCatchPattern":"try {\n  const projects = await provisionObservabilityProject(...);\n} catch (err) {\n  if (err.message.startsWith('Failed to list projects')) {\n    const status = err.message.match(/\\((\\d+)\\)/)?.[1];\n    if (status === '401' || status === '403') await reauth();\n    else if (status?.startsWith('5')) await retryWithBackoff();\n  }\n}","preventionTips":["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."],"tags":["network","api","authentication","http"],"backgroundTag":"http-request-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}