{"record":{"id":"e1d1af62c7a04fc8","repo":"mastra-ai/mastra","slug":"failed-to-read-studio-routes-manifest-at-manife","errorCode":null,"errorMessage":"Failed to read studio routes manifest at \"${manifestPath}\": ${err instanceof Error ? err.message : err}","messagePattern":"Failed to read studio routes manifest at \"(.+?)\": (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deployers/vercel/src/index.ts","lineNumber":87,"sourceCode":"    }\n  }\n\n  /**\n   * Studio's top-level route segments, emitted by the Studio build alongside index.html.\n   * The Vercel route table needs them explicitly: custom `registerApiRoute()` paths are mounted\n   * at the root of the server, so the function has to own every path Studio doesn't claim.\n   */\n  private readStudioRouteRoots(studioSource: string): string[] {\n    const manifestPath = join(studioSource, 'routes-manifest.json');\n\n    try {\n      const roots = JSON.parse(readFileSync(manifestPath, 'utf-8'));\n      if (!Array.isArray(roots) || roots.some(root => typeof root !== 'string')) {\n        throw new Error('expected an array of route segments');\n      }\n      return roots;\n    } catch (err) {\n      throw new Error(\n        `Failed to read studio routes manifest at \"${manifestPath}\": ${err instanceof Error ? err.message : err}`,\n      );\n    }\n  }\n\n  private getEntry(): string {\n    return `\nimport { handle } from 'hono/vercel'\nimport { mastra } from '#mastra';\nimport { createHonoServer, getToolExports } from '#server';\nimport { tools } from '#tools';\nimport { scoreTracesWorkflow } from '@mastra/core/evals/scoreTraces';\n\nif (mastra.getStorage()) {\n  mastra.__registerInternalWorkflow(scoreTracesWorkflow);\n}\n\nconst app = await createHonoServer(mastra, { tools: getToolExports(tools) });","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/deployers/vercel/src/index.ts#L69-L105","documentation":"This is the wrapper error thrown when reading or parsing studio's routes-manifest.json fails for any reason: the file doesn't exist (ENOENT), is invalid JSON, or fails the array-of-strings validation (error 272). The original cause is embedded in the message via err.message.","triggerScenarios":"prepare() calls readStudioRouteRoots but studioSource/routes-manifest.json is missing, unreadable, invalid JSON, or has the wrong shape.","commonSituations":"Deploying before the studio build ran; deploying from the wrong working directory so the path doesn't resolve; CI cache serving an empty or partial manifest.","solutions":["Build the studio first so routes-manifest.json exists in studioSource.","Check the embedded err.message for the root cause (ENOENT vs JSON parse vs shape).","Verify your outputDirectory/studioSource configuration points at the built studio output.","Clean the build cache and rebuild if the manifest appears truncated."],"exampleFix":"// before\nvercel deploy  # .vercel/output built without studio manifest\n// after\npnpm build:studio && vercel deploy","handlingStrategy":"try-catch","validationCode":"import { existsSync } from 'node:fs';\nconst manifestPath = join(studioSource, 'routes-manifest.json');\nif (!existsSync(manifestPath)) {\n  throw new Error(`Missing ${manifestPath}; run the studio build before deploying.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await deployer.prepare();\n} catch (err) {\n  const msg = (err as Error).message;\n  if (msg.includes('Failed to read studio routes manifest')) {\n    if (msg.includes('ENOENT')) console.error('Studio not built; build it first.');\n    else console.error('Manifest unreadable/invalid:', msg);\n  }\n  throw err;\n}","preventionTips":["Run the studio build as a prerequisite step in every deploy pipeline.","Verify studioSource/outputDirectory paths resolve from the deploy working directory.","Avoid partial CI caches — clean the output dir on cache restore.","Check the embedded err.message to distinguish ENOENT from parse errors."],"tags":["deployer","vercel","manifest","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}