{"record":{"id":"881ffa8c4ef058bf","repo":"abhigyanpatwari/GitNexus","slug":"unknown-prompt-name","errorCode":null,"errorMessage":"Unknown prompt: ${name}","messagePattern":"Unknown prompt: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/mcp/server.ts","lineNumber":332,"sourceCode":"            role: 'user' as const,\n            content: {\n              type: 'text' as const,\n              text: `Generate architecture documentation for this codebase using the knowledge graph.\n\nFollow these steps:\n1. READ \\`gitnexus://repo/${repo || '{name}'}/context\\` for codebase stats\n2. READ \\`gitnexus://repo/${repo || '{name}'}/clusters\\` to see all functional areas\n3. READ \\`gitnexus://repo/${repo || '{name}'}/processes\\` to see all execution flows\n4. For the top 5 most important processes, READ \\`gitnexus://repo/${repo || '{name}'}/process/{name}\\` for step-by-step traces\n5. Generate a mermaid architecture diagram showing the major areas and their connections\n6. Write an ARCHITECTURE.md file with: overview, functional areas, key execution flows, and the mermaid diagram`,\n            },\n          },\n        ],\n      };\n    }\n\n    throw new Error(`Unknown prompt: ${name}`);\n  });\n\n  return server;\n}\n\n/**\n * Start the MCP server on stdio transport (for CLI use).\n */\n/** Force-exit fallback budget if graceful shutdown cleanup hangs. */\nconst SHUTDOWN_FORCE_EXIT_MS = 5_000;\n\n/** Conventional 128 + signal-number exit codes for graceful termination. */\nexport const SHUTDOWN_EXIT_CODES = { SIGINT: 130, SIGTERM: 143 } as const;\n\ntype SignalRegistrar = (\n  event: 'SIGINT' | 'SIGTERM',\n  listener: (...args: unknown[]) => void,\n) => void;","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/mcp/server.ts#L314-L350","documentation":"The MCP prompts/get handler in gitnexus/src/mcp/server.ts knows exactly two prompts — detect_impact (args: scope, base_ref) and generate_map (args: repo). Any other prompt name falls past both if-blocks and hits this throw.","triggerScenarios":"prompts/get with name 'generate-architecture', 'map', 'impact_detection', or any rename/variant of the two real names; also names sourced from a different GitNexus version's prompt list.","commonSituations":"An MCP client (or the model driving it) guessing prompt names instead of calling prompts/list; stale hardcoded prompt names after a GitNexus upgrade renamed or removed a prompt; hyphen-vs-underscore confusion.","solutions":["Call prompts/list first and use a returned name verbatim","Use exactly 'detect_impact' or 'generate_map'","Update the pinned gitnexus version if docs mention a prompt the server does not expose"],"exampleFix":"// before\nconst p = await client.getPrompt('generate-architecture');\n\n// after\nconst p = await client.getPrompt('generate_map');","handlingStrategy":"validation","validationCode":"const KNOWN_PROMPTS = ['detect_impact', 'generate_map'];\nfunction assertKnownPrompt(name) {\n  if (!KNOWN_PROMPTS.includes(name)) throw new Error(`Unknown prompt: ${name}; known: ${KNOWN_PROMPTS.join(', ')}`);\n}","typeGuard":"function isKnownPromptName(name, advertised) {\n  return advertised ? advertised.some((p) => p.name === name) : ['detect_impact', 'generate_map'].includes(name);\n}","tryCatchPattern":"try { return await server.getPrompt(name); }\ncatch (e) {\n  if (e.message.startsWith('Unknown prompt:')) { const list = await server.listPrompts(); throw new Error(`Pick from: ${list.prompts.map((p) => p.name).join(', ')}`); }\n  throw e;\n}","preventionTips":["Call prompts/list once at client startup and hardcode nothing","Treat the advertised prompt list as the contract; re-fetch after upgrading gitnexus","Validate LLM-proposed tool/prompt names against the advertised set before dispatch"],"tags":["mcp","prompts","validation","client-error"],"backgroundTag":"unknown-prompt-name","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}