{"record":{"id":"74f50a3038a28710","repo":"davila7/claude-code-templates","slug":"failed-to-load-timeline","errorCode":null,"errorMessage":"Failed to load timeline","messagePattern":"Failed to load timeline","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":715,"sourceCode":"    this.app.get('/api/sessions/:id/timeline', 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        const page = parseInt(req.query.page) || 0;\n        const pageSize = parseInt(req.query.pageSize) || 50;\n        const start = page * pageSize;\n        const events = session.events.slice(start, start + pageSize);\n\n        res.json({\n          events,\n          total: session.events.length,\n          page,\n          pageSize,\n          hasMore: start + pageSize < session.events.length\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load timeline' });\n      }\n    });\n\n    // Communications\n    this.app.get('/api/sessions/:id/communications', 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          communications: session.communications,\n          count: session.communications.length\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load communications' });\n      }\n    });\n","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L697-L733","documentation":"Catch-all HTTP 500 for the teams dashboard timeline route: session parsed successfully but slicing/paginating events threw — usually a malformed event array or serialization error (circular structure, BigInt).","triggerScenarios":"GET /api/sessions/:id/timeline?page=N&pageSize=M where session.events is undefined or contains non-serializable values; also parseInt failures on NaN inputs fall back safely, so the throw is data-driven.","commonSituations":"Parser produced an events array with unexpected shapes after an upgrade; very large sessions hitting JSON serialization limits.","solutions":["Test the same session via /api/sessions/:id to isolate parsing vs serialization","Check parser output shape for the session; remove/repair the session file","Restart dashboard to re-parse"],"exampleFix":"// before\nconst events = session.events.slice(start, start + pageSize);\n// after\nconst events = (session.events || []).slice(start, start + pageSize);","handlingStrategy":"try-catch","validationCode":"const hasEvents = await fetch(`/api/sessions/${id}`).then(r => r.json()).then(s => Array.isArray(s.events));","typeGuard":"const hasEventArray = (s) => Array.isArray(s?.events);","tryCatchPattern":"try { const t = await getTimeline(id, page); } catch { fallbackToSessionDetail(id); }","preventionTips":["Degrade to session detail view if timeline fails","Bound pageSize to sane values"],"tags":["http-500","teams-dashboard","pagination"],"backgroundTag":"http-500-internal-server-error","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}