davila7/claude-code-templates · error

Failed to load summary

Error message

Failed to load summary

What it means

HTTP 500 from the teams dashboard GET /api/summary when reducing over this.sessions (totalSessions/totalAgents) throws — practically only if this.sessions contains unexpected entries (null rows, missing agentCount).

Source

Thrown at cli-tool/src/teams-dashboard.js:670

          })),
          count: this.sessions.length,
          timestamp: new Date().toISOString()
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load sessions' });
      }
    });

    // Global summary stats
    this.app.get('/api/summary', async (req, res) => {
      try {
        res.json({
          totalSessions: this.sessions.length,
          totalAgents: this.sessions.reduce((sum, s) => sum + s.agentCount, 0),
          timestamp: new Date().toISOString()
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load summary' });
      }
    });

    // Full session detail (triggers parse)
    this.app.get('/api/sessions/:id', async (req, res) => {
      try {
        const session = await this.parseFullSession(req.params.id);
        if (!session) return res.status(404).json({ error: 'Session not found' });

        res.json({
          id: session.id,
          projectName: session.projectName,
          gitBranch: session.gitBranch,
          startTime: session.startTime,
          endTime: session.endTime,
          duration: session.duration,
          agents: session.agents,
          teammateNames: session.teammateNames,

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Restart dashboard to re-parse sessions
  2. Inspect this.sessions for entries missing agentCount; remove corrupt session files
  3. Check parser handles empty/partial session files

Example fix

// before
totalAgents: this.sessions.reduce((sum, s) => sum + s.agentCount, 0)
// after
totalAgents: this.sessions.reduce((sum, s) => sum + (s.agentCount || 0), 0)
Defensive patterns

Strategy: fallback

Try / catch

try { summary = await getSummary(); } catch { summary = { totalSessions: 0, totalAgents: 0 }; }

Prevention

When it happens

Trigger: GET /api/summary after session parsing produced entries without agentCount (null/undefined), making the reduce arithmetic throw on null.

Common situations: Partial or corrupt session files parsed into malformed session objects; parser version mismatch after upgrade.

Related errors


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