{"record":{"id":"524fce9762aa54ee","repo":"davila7/claude-code-templates","slug":"failed-to-generate-activity-data","errorCode":null,"errorMessage":"Failed to generate activity data","messagePattern":"Failed to generate activity data","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/analytics.js","lineNumber":1231,"sourceCode":"        res.status(500).json({ \n          error: 'Failed to clear cache', \n          details: error.message \n        });\n      }\n    });\n\n    // Activity heatmap data endpoint — uses in-memory cached conversations\n    this.app.get('/api/activity', async (req, res) => {\n      try {\n        const conversations = this.data.conversations ?? [];\n        const activityData = this.generateActivityDataFromConversations(conversations);\n        res.json({\n          ...activityData,\n          timestamp: new Date().toISOString()\n        });\n      } catch (error) {\n        console.error('Error generating activity data:', error);\n        res.status(500).json({ error: 'Failed to generate activity data' });\n      }\n    });\n\n    // Year in Review 2025 API endpoint\n    this.app.get('/api/2025', async (req, res) => {\n      try {\n        console.log('📅 Generating 2025 Year in Review...');\n\n        // Load all conversations for analysis\n        const allConversations = await this.conversationAnalyzer.loadConversations(this.stateCalculator);\n\n        // Generate year in review statistics\n        const yearInReview = await this.yearInReview2025.generateYearInReview(allConversations, this.claudeDir);\n\n        console.log(`✅ 2025 Year in Review generated with ${yearInReview.totalConversations} conversations`);\n\n        res.json({\n          ...yearInReview,","sourceCodeStart":1213,"sourceCodeEnd":1249,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/analytics.js#L1213-L1249","documentation":"500 from GET /api/activity. The handler computes activity/aggregated usage data from parsed conversations; failures in reading or aggregating the Claude projects data surface as this generic message.","triggerScenarios":"GET /api/activity when a conversation JSONL is corrupt, a file disappears during aggregation, or an in-memory aggregation hits an unexpected shape (e.g. missing field on a conversation object).","commonSituations":"Dashboard open while Claude Code writes sessions; projects dir contains leftover partial files; huge dirs causing read errors.","solutions":["Check console for 'Error generating activity data:' and the underlying stack","Clear conversation caches (POST /api/clear-cache?type=conversations) and retry","Scan ~/.claude/projects for 0-byte or truncated .jsonl files and remove them","Re-run the analytics scan/refresh endpoint to rebuild state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const convs = await fetch(base + '/api/conversations').then(r => r.ok); // data load sanity check\n","typeGuard":null,"tryCatchPattern":"try { return await getActivity(); } catch (e) { if (e.response?.status === 500) { await clearConversationCaches(); return await getActivity(); } throw e; }","preventionTips":["Clear conversation caches after crashes","Periodically prune corrupt .jsonl files from ~/.claude/projects"],"tags":["analytics","express","http-500","activity-data"],"backgroundTag":"data-aggregation-failure","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}