{"record":{"id":"4fc97824a3a23d3b","repo":"eyaltoledano/claude-task-master","slug":"could-not-read-or-parse-complexity-report-repor","errorCode":null,"errorMessage":"Could not read or parse complexity report: ${reportError.message}. Proceeding without it.","messagePattern":"Could not read or parse complexity report: (.+?)\\. Proceeding without it\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"scripts/modules/task-manager/expand-task.js","lineNumber":181,"sourceCode":"\t\t\t\tif (taskAnalysis) {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`Found complexity analysis for task ${task.id}: Score ${taskAnalysis.complexityScore}`\n\t\t\t\t\t);\n\t\t\t\t\tif (taskAnalysis.reasoning) {\n\t\t\t\t\t\tcomplexityReasoningContext = `\\nComplexity Analysis Reasoning: ${taskAnalysis.reasoning}`;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t`No complexity analysis found for task ${task.id} in report.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogger.info(\n\t\t\t\t\t`Complexity report not found at ${complexityReportPath}. Skipping complexity check.`\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (reportError) {\n\t\t\tlogger.warn(\n\t\t\t\t`Could not read or parse complexity report: ${reportError.message}. Proceeding without it.`\n\t\t\t);\n\t\t}\n\n\t\t// Determine final subtask count\n\t\tconst explicitNumSubtasks = parseInt(numSubtasks, 10);\n\t\tif (!Number.isNaN(explicitNumSubtasks) && explicitNumSubtasks >= 0) {\n\t\t\tfinalSubtaskCount = explicitNumSubtasks;\n\t\t\tlogger.info(\n\t\t\t\t`Using explicitly provided subtask count: ${finalSubtaskCount}`\n\t\t\t);\n\t\t} else if (taskAnalysis?.recommendedSubtasks) {\n\t\t\tfinalSubtaskCount = parseInt(taskAnalysis.recommendedSubtasks, 10);\n\t\t\tlogger.info(\n\t\t\t\t`Using subtask count from complexity report: ${finalSubtaskCount}`\n\t\t\t);\n\t\t} else {\n\t\t\tfinalSubtaskCount = getDefaultSubtasks(session);","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/expand-task.js#L163-L199","documentation":"expandTask optionally consults scripts/task-complexity-report.json to pick a sensible subtask count and prompt context. If the report exists but cannot be read or parsed (corrupt JSON, permission error), the failure is caught and logged as this warning; expansion proceeds without complexity data.","triggerScenarios":"expandTask runs with a complexity report file present at complexityReportPath, but JSON.parse or fs read fails (truncated file, invalid JSON, permissions).","commonSituations":"A previous 'task-master analyze-complexity' run was interrupted mid-write; the file was hand-edited into invalid JSON; a stale file from a different format version.","solutions":["Delete or regenerate the report: run 'task-master analyze-complexity' to recreate scripts/task-complexity-report.json.","Validate the JSON manually (e.g. `node -e \"JSON.parse(require('fs').readFileSync('scripts/task-complexity-report.json'))\"`) and fix syntax errors.","Proceed without it — expansion still works using explicit/default subtask counts."],"exampleFix":"// before: hand-edited report with trailing comma\n{ \"complexityAnalysis\": [ ... ], }\n// after\n{ \"complexityAnalysis\": [ ... ] }","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst reportPath = 'scripts/task-complexity-report.json';\nif (fs.existsSync(reportPath)) {\n  try { JSON.parse(fs.readFileSync(reportPath, 'utf8')); }\n  catch (e) { console.error('Corrupt complexity report — regenerate with task-master analyze-complexity'); }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const report = JSON.parse(fs.readFileSync(reportPath, 'utf8'));\n} catch (e) {\n  const report = null; // proceed without complexity data, as expandTask does\n}","preventionTips":["Avoid hand-editing task-complexity-report.json; regenerate instead.","Ensure analyze-complexity completes before running expand (don't interrupt writes).","Delete stale reports after schema upgrades."],"tags":["complexity-report","json","parse-error"],"backgroundTag":"json-parse-error","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}