davila7/claude-code-templates · error

Failed to generate year in review

Error message

Failed to generate year in review

What it means

500 from GET /api/2025 (Year in Review). The handler generates the yearly summary; unlike its siblings it includes error.message, so the response tells you the actual generation failure (usually reading/aggregating a year of conversation data).

Source

Thrown at cli-tool/src/analytics.js:1254

    this.app.get('/api/2025', async (req, res) => {
      try {
        console.log('📅 Generating 2025 Year in Review...');

        // Load all conversations for analysis
        const allConversations = await this.conversationAnalyzer.loadConversations(this.stateCalculator);

        // Generate year in review statistics
        const yearInReview = await this.yearInReview2025.generateYearInReview(allConversations, this.claudeDir);

        console.log(`✅ 2025 Year in Review generated with ${yearInReview.totalConversations} conversations`);

        res.json({
          ...yearInReview,
          timestamp: new Date().toISOString()
        });
      } catch (error) {
        console.error('Error generating 2025 year in review:', error);
        res.status(500).json({
          error: 'Failed to generate year in review',
          message: error.message
        });
      }
    });

    // Year in Review 2025 page route
    this.app.get('/2025', (req, res) => {
      res.sendFile(path.join(__dirname, 'analytics-web', '2025.html'));
    });

    // Main dashboard route
    this.app.get('/', (req, res) => {
      res.sendFile(path.join(__dirname, 'analytics-web', 'index.html'));
    });
  }

  async startServer() {

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Read the 'message' field of the 500 response — it carries error.message
  2. Clear caches and retry the endpoint
  3. Prune or archive very old/corrupt conversation files under ~/.claude/projects
  4. If it consistently fails on one file, the message usually names it; remove/fix that file
Defensive patterns

Strategy: try-catch

Validate before calling

const hasData = await fetch(base + '/api/conversations').then(r => r.ok);

Try / catch

try { return await getYearInReview(); } catch (e) { if (e.message) log(e.message); return generateClientSideFallbackSummary(); }

Prevention

When it happens

Trigger: GET /api/2025 when the year-review generator throws — corrupt session files, missing timestamps in conversations, or resource exhaustion over a year of data.

Common situations: Very large conversation histories; sessions with malformed created_at fields; disk/read errors in ~/.claude/projects.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/3bc9cac40b791bd3. Report an issue: GitHub.