{"record":{"id":"76ec1c4d8cc4abd3","repo":"eyaltoledano/claude-task-master","slug":"analyze-core-error","errorCode":"ANALYZE_CORE_ERROR","errorMessage":"Error running core complexity analysis: ${error.message}","messagePattern":"Error running core complexity analysis: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/analyze-task-complexity.js","lineNumber":134,"sourceCode":"\t\t\t\tmcpLog: logWrapper,\n\t\t\t\tcommandName: 'analyze-complexity',\n\t\t\t\toutputType: 'mcp',\n\t\t\t\tprojectRoot,\n\t\t\t\ttag\n\t\t\t});\n\t\t\treport = coreResult.report;\n\t\t} catch (error) {\n\t\t\tlog.error(\n\t\t\t\t`Error in analyzeTaskComplexity core function: ${error.message}`\n\t\t\t);\n\t\t\t// Restore logging if we changed it\n\t\t\tif (!wasSilent && isSilentMode()) {\n\t\t\t\tdisableSilentMode();\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: 'ANALYZE_CORE_ERROR',\n\t\t\t\t\tmessage: `Error running core complexity analysis: ${error.message}`\n\t\t\t\t}\n\t\t\t};\n\t\t} finally {\n\t\t\t// Always restore normal logging in finally block if we enabled silent mode\n\t\t\tif (!wasSilent && isSilentMode()) {\n\t\t\t\tdisableSilentMode();\n\t\t\t}\n\t\t}\n\n\t\t// --- Result Handling (remains largely the same) ---\n\t\t// Verify the report file was created (core function writes it)\n\t\tif (!fs.existsSync(resolvedOutputPath)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'ANALYZE_REPORT_MISSING', // Specific code\n\t\t\t\t\tmessage:","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/analyze-task-complexity.js#L116-L152","documentation":"When the underlying core complexity analysis (the function this direct wrapper delegates to) throws — e.g. AI provider failure, malformed tasks.json, model/API errors — the wrapper catches it and re-raises as a structured ANALYZE_CORE_ERROR wrapping the original error message.","triggerScenarios":"Any exception thrown by the core analyzeTaskComplexity call: invalid tasks.json content, AI service/API failure, missing API key, or an unexpected internal error.","commonSituations":"Expired or missing AI provider API keys; corrupted or hand-edited tasks.json; rate limits from the LLM provider; network outage during analysis.","solutions":["Read the embedded error.message in the response to identify the root cause","Validate tasks.json parses as JSON and tasks are well-formed before analyzing","Check AI provider credentials (API key env vars) and network/provider status, then retry"],"exampleFix":"// before\n// tasks.json hand-edited, trailing comma\n// after\nJSON.parse(fs.readFileSync(tasksJsonPath)); // fix syntax errors, then re-run analysis","handlingStrategy":"try-catch","validationCode":"try {\n  JSON.parse(fs.readFileSync(args.tasksJsonPath, 'utf8'));\n} catch (e) {\n  throw new Error(`tasks.json invalid before analysis: ${e.message}`);\n}\nif (!process.env.ANTHROPIC_API_KEY && !process.env.OPENAI_API_KEY) {\n  throw new Error('No AI provider API key configured');\n}","typeGuard":"function isCoreError(res) {\n  return typeof res === 'object' && res !== null && res.success === false && res.error?.code === 'ANALYZE_CORE_ERROR';\n}","tryCatchPattern":"const res = await analyzeTaskComplexityDirect(args);\nif (isCoreError(res)) {\n  console.error('Root cause:', res.error.message); // e.g. API key / JSON parse issue\n  // fix credentials or tasks.json, then retry with backoff\n}","preventionTips":["Validate tasks.json syntax before analysis","Keep AI provider API keys set and rotated","Rate-limit and retry LLM-dependent analysis with exponential backoff","Pin task-master versions so core/direct function contracts match"],"tags":["mcp","analysis","ai-provider","wrapped-error"],"backgroundTag":"analysis-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}