{"record":{"id":"df7374268ee3e5d5","repo":"eyaltoledano/claude-task-master","slug":"invalid-complexity-report-structure-at-reportpat","errorCode":null,"errorMessage":"Invalid complexity report structure at ${reportPath}, ignoring","messagePattern":"Invalid complexity report structure at (.+?), ignoring","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/tm-core/src/modules/reports/managers/complexity-report-manager.ts","lineNumber":63,"sourceCode":"\n\t\t// Check cache first\n\t\tif (this.reportCache.has(cacheKey)) {\n\t\t\treturn this.reportCache.get(cacheKey)!;\n\t\t}\n\n\t\tconst reportPath = this.getReportPath(tag);\n\n\t\ttry {\n\t\t\t// Check if file exists\n\t\t\tawait fs.access(reportPath);\n\n\t\t\t// Read and parse the report\n\t\t\tconst content = await fs.readFile(reportPath, 'utf-8');\n\t\t\tconst report = JSON.parse(content) as ComplexityReport;\n\n\t\t\t// Validate basic structure\n\t\t\tif (!report.meta || !Array.isArray(report.complexityAnalysis)) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`Invalid complexity report structure at ${reportPath}, ignoring`\n\t\t\t\t);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Cache the report\n\t\t\tthis.reportCache.set(cacheKey, report);\n\n\t\t\tlogger.debug(\n\t\t\t\t`Loaded complexity report for tag '${resolvedTag}' with ${report.complexityAnalysis.length} analyses`\n\t\t\t);\n\n\t\t\treturn report;\n\t\t} catch (error: any) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\t// File doesn't exist - this is normal, not all projects have complexity reports\n\t\t\t\tlogger.debug(`No complexity report found for tag '${resolvedTag}'`);\n\t\t\t\treturn null;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/reports/managers/complexity-report-manager.ts#L45-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Regenerate the complexity report with the supported tool so it writes the expected structure","Verify reportPath points at the actual complexity report, not another JSON file","Inspect the file: it must contain `meta` object and `complexityAnalysis` array","If null is returned downstream, handle the missing report gracefully (recompute or skip analysis)"],"exampleFix":"// before\nreportPath = './complexity.json'; // arbitrary JSON\n// after\nreportPath = './reports/task-complexity-report.json'; // generated by complexity-report tool","handlingStrategy":"validation","validationCode":"function looksLikeComplexityReport(obj: unknown): obj is ComplexityReport {\n  const r = obj as ComplexityReport;\n  return !!obj && typeof r === 'object' && !!r.meta && Array.isArray(r.complexityAnalysis);\n}\nconst parsed = JSON.parse(await fs.readFile(reportPath, 'utf-8'));\nif (!looksLikeComplexityReport(parsed)) throw new Error(`${reportPath} is not a valid complexity report`);","typeGuard":"function isComplexityReport(v: unknown): v is ComplexityReport {\n  const r = v as ComplexityReport;\n  return typeof r === 'object' && r !== null && 'meta' in r && Array.isArray((r as any).complexityAnalysis);\n}","tryCatchPattern":"const report = await manager.loadReport(path);\nif (report === null) {\n  console.warn(`Report at ${path} invalid or missing; regenerating...`);\n  await regenerateReport();\n}","preventionTips":["Never hand-edit generated report files","Regenerate reports after tool version upgrades","Point configuration at the exact report filename produced by the tool","Check the report loads right after generation in CI"],"tags":["reports","json","validation"],"backgroundTag":"invalid-report-schema","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}