{"record":{"id":"c43a3f011f39eff6","repo":"davila7/claude-code-templates","slug":"could-not-analyze-subagents","errorCode":null,"errorMessage":"Could not analyze subagents:","messagePattern":"Could not analyze subagents:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli-tool/src/analytics/core/YearInReview2025.js","lineNumber":977,"sourceCode":"            type: type,\n            count: dayData.count // How many times used that day\n          });\n        });\n      });\n\n      subagentEvents.sort((a, b) => a.timestamp - b.timestamp);\n\n      return {\n        subagents: Object.entries(groupedByType).map(([type, data]) => ({\n          type,\n          count: data.count\n        })),\n        total: subagents.length,\n        events: subagentEvents,\n        grouped: groupedByType // Include grouped data for display\n      };\n    } catch (error) {\n      console.warn('Could not analyze subagents:', error.message);\n      return { subagents: [], total: 0, events: [] };\n    }\n  }\n}\n\nmodule.exports = YearInReview2025;\n","sourceCodeStart":959,"sourceCodeEnd":984,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/analytics/core/YearInReview2025.js#L959-L984","documentation":"YearInReview2025 subagent analysis caught an error and returns empty subagent usage ({subagents: [], total: 0, events: []}); the subagent section of the year-in-review shows nothing.","triggerScenarios":"Scanning conversation logs for subagent (Task tool) usage throws — unexpected message structure, unreadable conversation files, or a missing groupedByType intermediate key.","commonSituations":"Conversation format drift between Claude Code versions; large logs with unusual tool_use payloads; permissions on conversation files.","solutions":["Ignore — other report sections still render","Update the CLI/analytics package for current conversation formats","Check conversation file readability under ~/.claude/projects","Re-run — transient file races can cause one-off failures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sample-validate one conversation before the subagent pass\nconst first = JSON.parse((await fs.readFile(f, 'utf8')).split('\\n')[0]);\nif (!first.type) skipOrFlag(f);","typeGuard":"function isToolUse(msg) {\n  return !!msg && msg.type === 'assistant' && Array.isArray(msg.message?.content) &&\n    msg.message.content.some(c => c.type === 'tool_use' && c.name === 'Task');\n}","tryCatchPattern":"try { return analyzeSubagents(...); }\ncatch (error) { console.warn('Could not analyze subagents:', error.message); return { subagents: [], total: 0, events: [] }; }","preventionTips":["Keep the CLI updated alongside Claude Code version changes","Treat missing subagent stats as non-fatal","Optionally prune ancient conversations before running year-in-review"],"tags":["year-in-review","subagents","parsing"],"backgroundTag":"conversation-file-parse-error","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}