eyaltoledano/claude-task-master · warning

Could not read or parse complexity report: ${reportError.mes

Error message

Could not read or parse complexity report: ${reportError.message}. Proceeding without it.

What it means

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.

Source

Thrown at scripts/modules/task-manager/expand-task.js:181

				if (taskAnalysis) {
					logger.info(
						`Found complexity analysis for task ${task.id}: Score ${taskAnalysis.complexityScore}`
					);
					if (taskAnalysis.reasoning) {
						complexityReasoningContext = `\nComplexity Analysis Reasoning: ${taskAnalysis.reasoning}`;
					}
				} else {
					logger.info(
						`No complexity analysis found for task ${task.id} in report.`
					);
				}
			} else {
				logger.info(
					`Complexity report not found at ${complexityReportPath}. Skipping complexity check.`
				);
			}
		} catch (reportError) {
			logger.warn(
				`Could not read or parse complexity report: ${reportError.message}. Proceeding without it.`
			);
		}

		// Determine final subtask count
		const explicitNumSubtasks = parseInt(numSubtasks, 10);
		if (!Number.isNaN(explicitNumSubtasks) && explicitNumSubtasks >= 0) {
			finalSubtaskCount = explicitNumSubtasks;
			logger.info(
				`Using explicitly provided subtask count: ${finalSubtaskCount}`
			);
		} else if (taskAnalysis?.recommendedSubtasks) {
			finalSubtaskCount = parseInt(taskAnalysis.recommendedSubtasks, 10);
			logger.info(
				`Using subtask count from complexity report: ${finalSubtaskCount}`
			);
		} else {
			finalSubtaskCount = getDefaultSubtasks(session);

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Delete or regenerate the report: run 'task-master analyze-complexity' to recreate scripts/task-complexity-report.json.
  2. Validate the JSON manually (e.g. `node -e "JSON.parse(require('fs').readFileSync('scripts/task-complexity-report.json'))"`) and fix syntax errors.
  3. Proceed without it — expansion still works using explicit/default subtask counts.

Example fix

// before: hand-edited report with trailing comma
{ "complexityAnalysis": [ ... ], }
// after
{ "complexityAnalysis": [ ... ] }
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const reportPath = 'scripts/task-complexity-report.json';
if (fs.existsSync(reportPath)) {
  try { JSON.parse(fs.readFileSync(reportPath, 'utf8')); }
  catch (e) { console.error('Corrupt complexity report — regenerate with task-master analyze-complexity'); }
}

Try / catch

try {
  const report = JSON.parse(fs.readFileSync(reportPath, 'utf8'));
} catch (e) {
  const report = null; // proceed without complexity data, as expandTask does
}

Prevention

When it happens

Trigger: expandTask runs with a complexity report file present at complexityReportPath, but JSON.parse or fs read fails (truncated file, invalid JSON, permissions).

Common situations: 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.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/4fc97824a3a23d3b. Report an issue: GitHub.