{"record":{"id":"eb95cc447a6058c7","repo":"davila7/claude-code-templates","slug":"failed-to-load-communications","errorCode":null,"errorMessage":"Failed to load communications","messagePattern":"Failed to load communications","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":730,"sourceCode":"          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\n    // Tasks\n    this.app.get('/api/sessions/:id/tasks', 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          tasks: session.tasks,\n          count: session.tasks.length\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load tasks' });\n      }\n    });\n","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L712-L748","documentation":"Catch-all HTTP 500 for the communications route: session parsed but accessing session.communications.length threw (communications undefined) or JSON serialization failed.","triggerScenarios":"GET /api/sessions/:id/communications where the parser omitted the communications field (older session format or empty log).","commonSituations":"Sessions produced by an older CLI version lacking teammate messaging; partially written logs.","solutions":["Update/restart the dashboard so the parser fills defaults","Guard with (session.communications || []) — or remove the problematic session file","Check /api/sessions/:id output shape"],"exampleFix":"// before\ncommunications: session.communications,\ncount: session.communications.length\n// after\ncommunications: session.communications || [],\ncount: (session.communications || []).length","handlingStrategy":"fallback","validationCode":"const detail = await fetch(`/api/sessions/${id}`).then(r => r.json());\nif (!Array.isArray(detail.communications)) fallbackToEmpty();","typeGuard":"const hasComms = (s) => Array.isArray(s?.communications);","tryCatchPattern":"try { comms = await getComms(id); } catch { comms = { communications: [], count: 0 }; }","preventionTips":["Default to empty arrays when the field is missing","Show 'no communications' rather than an error state"],"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"}