{"record":{"id":"16b0aaafb5351dee","repo":"davila7/claude-code-templates","slug":"failed-to-load-sessions","errorCode":null,"errorMessage":"Failed to load sessions","messagePattern":"Failed to load sessions","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":657,"sourceCode":"    this.app.get('/api/sessions', async (req, res) => {\n      try {\n        this.sessions = await this.discoverTeamSessions();\n        res.json({\n          sessions: this.sessions.map(s => ({\n            id: s.id,\n            projectName: s.projectName,\n            agentCount: s.agentCount,\n            startTime: s.startTime,\n            endTime: s.endTime,\n            duration: s.duration,\n            gitBranch: s.gitBranch,\n            teammateNames: s.teammateNames\n          })),\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) => {","sourceCodeStart":639,"sourceCodeEnd":675,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L639-L675","documentation":"HTTP 500 from the teams dashboard GET /api/sessions when building the session list throws — typically a failure while reading/parsing ~/.claude/teams session JSONL files into this.sessions.","triggerScenarios":"GET /api/sessions when session discovery hits an unreadable file, malformed JSONL, or a missing teams data directory.","commonSituations":"Corrupt session log files from a crashed run; permissions on the Claude data dir; dashboard started with a changed HOME.","solutions":["Check the thrown error (add a console.error/log of the exception)","Inspect ~/.claude/teams session files for corruption and remove/repair them","Fix read permissions on the sessions directory"],"exampleFix":"// before\n} catch (error) {\n  res.status(500).json({ error: 'Failed to load sessions' });\n}\n// after\n} catch (error) {\n  console.error('Failed to load sessions:', error);\n  res.status(500).json({ error: 'Failed to load sessions', detail: String(error) });\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const r = await fetch('/api/sessions'); if (!r.ok) throw new Error((await r.json()).error); } catch (e) { showError(e); }","preventionTips":["Back up session JSONL files","Log the underlying error server-side for diagnosis"],"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"}