{"record":{"id":"c309f0a3ed0dfbe1","repo":"mastra-ai/mastra","slug":"prompt-not-found-name","errorCode":null,"errorMessage":"Prompt not found: ${name}","messagePattern":"Prompt not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp-docs-server/src/prompts/migration.ts","lineNumber":40,"sourceCode":"  },\n  {\n    name: 'migration-checklist',\n    version: 'v1',\n    description:\n      'Get a comprehensive checklist for migrating to Mastra v1.0. Lists all breaking changes that need to be addressed.',\n  },\n];\n\n/**\n * Prompt messages callback that generates contextual migration guidance\n */\nexport const migrationPromptMessages: MCPServerPrompts = {\n  listPrompts: async () => migrationPrompts,\n\n  getPromptMessages: async ({ name, args }): Promise<PromptMessage[]> => {\n    const prompt = migrationPrompts.find(p => p.name === name);\n    if (!prompt) {\n      throw new Error(`Prompt not found: ${name}`);\n    }\n\n    if (name === 'upgrade-to-v1') {\n      return getUpgradeToV1Messages(args?.area);\n    }\n\n    if (name === 'migration-checklist') {\n      return getMigrationChecklistMessages();\n    }\n\n    throw new Error(`No message handler for prompt: ${name}`);\n  },\n};\n\n/**\n * Generate messages for the upgrade-to-v1 prompt\n */\nfunction getUpgradeToV1Messages(area?: string): PromptMessage[] {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp-docs-server/src/prompts/migration.ts#L22-L58","documentation":"The migration prompts module (packages/mcp-docs-server) looks up a prompt by name in its static `migrationPrompts` list in getPromptMessages and throws a plain Error `Prompt not found: ${name}` when no prompt matches. This means the MCP client requested a prompt name the docs server does not offer.","triggerScenarios":"An MCP client calls prompts/get with a `name` that is not one of the names in `migrationPrompts` (e.g. a typo like 'upgrade-to-v2', or a prompt from a different MCP server).","commonSituations":"Client-side hardcoded prompt names diverging from server versions; renaming a prompt on the server while clients cache the old name; calling the migration server expecting prompts from another docs server.","solutions":["Call prompts/list first and use an exact name from the returned list","Fix the requested name to one of the available migration prompts (e.g. 'upgrade-to-v1', 'migration-checklist')","If you control both sides, update the client to the renamed prompt after a server version bump"],"exampleFix":"// before\nawait client.getPrompt({ name: 'upgrade-to-v2', args: { area: 'storage' } });\n// after\nconst { prompts } = await client.listPrompts();\nconst name = prompts.find(p => p.name.startsWith('upgrade-to'))?.name;\nawait client.getPrompt({ name, args: { area: 'storage' } });","handlingStrategy":"validation","validationCode":"const available = (await client.listPrompts()).prompts.map(p => p.name);\nif (!available.includes(requestedName)) {\n  throw new Error(`Prompt '${requestedName}' not offered. Available: ${available.join(', ')}`);\n}","typeGuard":"function isKnownPrompt(name: string, prompts: { name: string }[]): name is string {\n  return prompts.some(p => p.name === name);\n}","tryCatchPattern":"try {\n  const result = await client.getPrompt({ name, args });\n} catch (e) {\n  if (String(e.message).startsWith('Prompt not found')) {\n    const { prompts } = await client.listPrompts();\n    console.error(`Unknown prompt '${name}'. Available: ${prompts.map(p => p.name).join(', ')}`);\n  } else throw e;\n}","preventionTips":["Always call prompts/list and pick names from it rather than hardcoding","Pin the MCP docs server version on the client to keep prompt names in sync","Validate prompt names against the list in tests"],"tags":["mcp","prompts","not-found","input-validation"],"backgroundTag":"prompt-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}