{"record":{"id":"25c5987d32614c08","repo":"davila7/claude-code-templates","slug":"failed-to-load-summary-25c598","errorCode":null,"errorMessage":"Failed to load summary","messagePattern":"Failed to load summary","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":670,"sourceCode":"          })),\n          count: this.sessions.length,\n          timestamp: new Date().toISOString()\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load sessions' });\n      }\n    });\n\n    // Global summary stats\n    this.app.get('/api/summary', async (req, res) => {\n      try {\n        res.json({\n          totalSessions: this.sessions.length,\n          totalAgents: this.sessions.reduce((sum, s) => sum + s.agentCount, 0),\n          timestamp: new Date().toISOString()\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load summary' });\n      }\n    });\n\n    // Full session detail (triggers parse)\n    this.app.get('/api/sessions/:id', async (req, res) => {\n      try {\n        const session = await this.parseFullSession(req.params.id);\n        if (!session) return res.status(404).json({ error: 'Session not found' });\n\n        res.json({\n          id: session.id,\n          projectName: session.projectName,\n          gitBranch: session.gitBranch,\n          startTime: session.startTime,\n          endTime: session.endTime,\n          duration: session.duration,\n          agents: session.agents,\n          teammateNames: session.teammateNames,","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L652-L688","documentation":"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).","triggerScenarios":"GET /api/summary after session parsing produced entries without agentCount (null/undefined), making the reduce arithmetic throw on null.","commonSituations":"Partial or corrupt session files parsed into malformed session objects; parser version mismatch after upgrade.","solutions":["Restart dashboard to re-parse sessions","Inspect this.sessions for entries missing agentCount; remove corrupt session files","Check parser handles empty/partial session files"],"exampleFix":"// before\ntotalAgents: this.sessions.reduce((sum, s) => sum + s.agentCount, 0)\n// after\ntotalAgents: this.sessions.reduce((sum, s) => sum + (s.agentCount || 0), 0)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { summary = await getSummary(); } catch { summary = { totalSessions: 0, totalAgents: 0 }; }","preventionTips":["Treat summary as optional UI data with a zeroed fallback","Guard against missing agentCount when consuming raw APIs"],"tags":["http-500","teams-dashboard","express"],"backgroundTag":"http-500-internal-server-error","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}