eyaltoledano/claude-task-master · warning

Invalid complexity report structure at ${reportPath}, ignori

Error message

Invalid complexity report structure at ${reportPath}, ignoring

What it means

complexity-report-manager.ts loadReport() reads a JSON complexity report from disk and validates that it has `meta` and a `complexityAnalysis` array. If the file is missing these, it logs this warning, returns null, and continues without the report instead of throwing.

Source

Thrown at packages/tm-core/src/modules/reports/managers/complexity-report-manager.ts:63

		// Check cache first
		if (this.reportCache.has(cacheKey)) {
			return this.reportCache.get(cacheKey)!;
		}

		const reportPath = this.getReportPath(tag);

		try {
			// Check if file exists
			await fs.access(reportPath);

			// Read and parse the report
			const content = await fs.readFile(reportPath, 'utf-8');
			const report = JSON.parse(content) as ComplexityReport;

			// Validate basic structure
			if (!report.meta || !Array.isArray(report.complexityAnalysis)) {
				logger.warn(
					`Invalid complexity report structure at ${reportPath}, ignoring`
				);
				return null;
			}

			// Cache the report
			this.reportCache.set(cacheKey, report);

			logger.debug(
				`Loaded complexity report for tag '${resolvedTag}' with ${report.complexityAnalysis.length} analyses`
			);

			return report;
		} catch (error: any) {
			if (error.code === 'ENOENT') {
				// File doesn't exist - this is normal, not all projects have complexity reports
				logger.debug(`No complexity report found for tag '${resolvedTag}'`);
				return null;

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Regenerate the complexity report with the supported tool so it writes the expected structure
  2. Verify reportPath points at the actual complexity report, not another JSON file
  3. Inspect the file: it must contain `meta` object and `complexityAnalysis` array
  4. If null is returned downstream, handle the missing report gracefully (recompute or skip analysis)

Example fix

// before
reportPath = './complexity.json'; // arbitrary JSON
// after
reportPath = './reports/task-complexity-report.json'; // generated by complexity-report tool
Defensive patterns

Strategy: validation

Validate before calling

function looksLikeComplexityReport(obj: unknown): obj is ComplexityReport {
  const r = obj as ComplexityReport;
  return !!obj && typeof r === 'object' && !!r.meta && Array.isArray(r.complexityAnalysis);
}
const parsed = JSON.parse(await fs.readFile(reportPath, 'utf-8'));
if (!looksLikeComplexityReport(parsed)) throw new Error(`${reportPath} is not a valid complexity report`);

Type guard

function isComplexityReport(v: unknown): v is ComplexityReport {
  const r = v as ComplexityReport;
  return typeof r === 'object' && r !== null && 'meta' in r && Array.isArray((r as any).complexityAnalysis);
}

Try / catch

const report = await manager.loadReport(path);
if (report === null) {
  console.warn(`Report at ${path} invalid or missing; regenerating...`);
  await regenerateReport();
}

Prevention

When it happens

Trigger: Calling loadReport() (via report()) on a file at reportPath that parses as JSON but lacks `meta` or has a non-array `complexityAnalysis` — e.g. a truncated, hand-edited, or older-format report.

Common situations: Report file corrupted by an interrupted generation, JSON produced by a different/older tool version, user manually edited the file, or pointing at the wrong JSON file (e.g. package.json) via configuration.

Related errors


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