{"record":{"id":"094b5bbe140dc4dd","repo":"eyaltoledano/claude-task-master","slug":"file-not-found-error-094b5b","errorCode":"FILE_NOT_FOUND_ERROR","errorMessage":"No complexity report found at ${reportPath}. Run 'analyze-complexity' first.","messagePattern":"No complexity report found at (.+?)\\. Run 'analyze-complexity' first\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/complexity-report.js","lineNumber":57,"sourceCode":"\t\tconst cacheKey = `complexityReport:${reportPath}`;\n\n\t\t// Define the core action function to read the report\n\t\tconst coreActionFn = async () => {\n\t\t\ttry {\n\t\t\t\t// Enable silent mode to prevent console logs from interfering with JSON response\n\t\t\t\tenableSilentMode();\n\n\t\t\t\tconst report = readComplexityReport(reportPath);\n\n\t\t\t\t// Restore normal logging\n\t\t\t\tdisableSilentMode();\n\n\t\t\t\tif (!report) {\n\t\t\t\t\tlog.warn(`No complexity report found at ${reportPath}`);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tcode: 'FILE_NOT_FOUND_ERROR',\n\t\t\t\t\t\t\tmessage: `No complexity report found at ${reportPath}. Run 'analyze-complexity' first.`\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tdata: {\n\t\t\t\t\t\treport,\n\t\t\t\t\t\treportPath\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\t// Make sure to restore normal logging even if there's an error\n\t\t\t\tdisableSilentMode();\n\n\t\t\t\tlog.error(`Error reading complexity report: ${error.message}`);\n\t\t\t\treturn {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/complexity-report.js#L39-L75","documentation":"After resolving the report path, the function loads the report data via the complexity analysis core. If no report object is found at the given path it returns FILE_NOT_FOUND_ERROR, telling the caller a complexity analysis has not been run (or the path is wrong). This is a guard against reading a nonexistent or empty report file.","triggerScenarios":"reportPath points to a file that does not exist; the analyze-complexity tool was never run in this project; the report lives under a different projectRoot; the report file was deleted or moved after generation.","commonSituations":"Fresh clone of a repo where reports/ is gitignored; running complexity-report from the wrong working directory; renamed report path between tool versions; CI environments without prior analysis step.","solutions":["Run 'task-master analyze-complexity' (or the analyze-complexity MCP tool) first to generate the report","Verify the file exists at reportPath (ls .taskmaster/reports/) and that the filename matches exactly","Ensure projectRoot and reportPath are consistent — resolve reportPath relative to the correct project root","Regenerate the report if it was produced by an older schema/version and can no longer be parsed"],"exampleFix":"// before\nawait complexityReportDirect({ reportPath: '.taskmaster/reports/complex-report.json' });\n// after\n// 1) generate it first\nawait analyzeComplexityDirect({ projectRoot, model: 'sonnet' });\n// 2) then read it\nawait complexityReportDirect({ reportPath: '.taskmaster/reports/complex-report.json', projectRoot });","handlingStrategy":"fallback","validationCode":"const fs = require('fs'); if (!fs.existsSync(reportPath)) { /* run analyze-complexity first */ }","typeGuard":"function reportExists(p) { try { return fs.statSync(p).isFile(); } catch { return false; } }","tryCatchPattern":"const res = await complexityReportDirect({ reportPath }); if (!res.success && res.error.code === 'FILE_NOT_FOUND_ERROR') { await analyzeComplexity(); }","preventionTips":["Add analyze-complexity as a prerequisite step in CI","Gitignore reports but regenerate them in setup scripts","Keep reportPath in a shared config constant so it never drifts"],"tags":["mcp","file-not-found","complexity-report"],"backgroundTag":"file-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}