{"record":{"id":"7cae4a1f4b409e48","repo":"eyaltoledano/claude-task-master","slug":"parse-prd-core-error","errorCode":"PARSE_PRD_CORE_ERROR","errorMessage":"${error.message || 'Unknown error parsing PRD'}","messagePattern":"\\$\\{error\\.message \\|\\| 'Unknown error parsing PRD'\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/parse-prd.js","lineNumber":207,"sourceCode":"\t\t\tlogWrapper.error(\n\t\t\t\t'Core parsePRD function did not return a successful structure.'\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'CORE_FUNCTION_ERROR',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\tresult?.message ||\n\t\t\t\t\t\t'Core function failed to parse PRD or returned unexpected result.'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\tlogWrapper.error(`Error executing core parsePRD: ${error.message}`);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'PARSE_PRD_CORE_ERROR',\n\t\t\t\tmessage: error.message || 'Unknown error parsing PRD'\n\t\t\t}\n\t\t};\n\t} finally {\n\t\tif (!wasSilent && isSilentMode()) {\n\t\t\tdisableSilentMode();\n\t\t}\n\t}\n}\n","sourceCodeStart":189,"sourceCodeEnd":217,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/parse-prd.js#L189-L217","documentation":"PARSE_PRD_CORE_ERROR is the catch-all failure envelope returned by parsePRDDirect when the underlying core parsePRD function throws an unexpected exception (e.g. unreadable PRD file, AI-provider failure, or invalid output path). parsePRDDirect wraps the core call in try/catch and converts any thrown error into this structured MCP response instead of crashing. The message is taken from the thrown error, falling back to 'Unknown error parsing PRD' when the error has no message.","triggerScenarios":"The core parsePRD() call at parse-prd.js:155 throws: PRD file missing/unreadable at inputPath, AI provider/API failure during task generation, invalid numTasks or outputPath, or any unhandled exception inside the core function.","commonSituations":"Calling the parse_prd MCP tool with a PRD path that doesn't exist; API key misconfiguration so the AI call fails; corrupted or empty PRD text file; permission errors writing tasks.json to outputPath.","solutions":["Read the message field — it carries the underlying core error; fix that root cause first","Verify the PRD input file exists and is readable at the given inputPath","Check AI provider configuration (API key, model) since parsePRD depends on an AI call","Confirm outputPath is writable and numTasks is a valid positive number","Retry the parse-prd call; transient AI provider failures surface here"],"exampleFix":"// before: parse-prd called without verifying the PRD file\nawait parsePRDDirect({ projectRoot, inputPath: 'docs/prd.txt' }, log);\n// after: validate inputs before calling\nconst fs = await import('fs');\nif (!fs.existsSync('docs/prd.txt')) throw new Error('PRD file not found');\nconst result = await parsePRDDirect({ projectRoot, inputPath: 'docs/prd.txt', numTasks: 10 }, log);\nif (!result.success) console.error(result.error.message);","handlingStrategy":"try-catch","validationCode":"import fs from 'fs';\nif (!args.inputPath || !fs.existsSync(args.inputPath)) {\n  throw new Error('PRD input file does not exist: ' + args.inputPath);\n}\nif (args.numTasks != null && (!Number.isInteger(args.numTasks) || args.numTasks < 1)) {\n  throw new Error('numTasks must be a positive integer');\n}","typeGuard":"function isParsePrdResult(r) {\n  return r != null && typeof r === 'object' && typeof r.success === 'boolean'\n    && (r.success === false ? r.error?.code != null : typeof r.data?.outputPath === 'string');\n}","tryCatchPattern":"const result = await parsePRDDirect(args, log);\nif (!result.success) {\n  if (result.error.code === 'PARSE_PRD_CORE_ERROR') {\n    console.error('PRD parse failed:', result.error.message);\n    // fix inputs / AI config, then retry\n  }\n}","preventionTips":["Verify the PRD file path exists and is readable before calling","Keep AI provider API keys and model config valid in the environment","Validate numTasks and outputPath are sane before invocation","Wrap calls so you inspect result.error.code rather than assuming success","Retry on transient AI provider failures surfaced in the message"],"tags":["mcp","prd","error-handling","ai-provider"],"backgroundTag":"prd-parse-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}