{"record":{"id":"e3538ae5b6b4d119","repo":"davila7/claude-code-templates","slug":"failed-to-load-session","errorCode":null,"errorMessage":"Failed to load session","messagePattern":"Failed to load session","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":692,"sourceCode":"    // 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,\n          stats: session.stats\n        });\n      } catch (error) {\n        res.status(500).json({ error: 'Failed to load session' });\n      }\n    });\n\n    // Timeline (paginated)\n    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,","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L674-L710","documentation":"Catch-all HTTP 500 for GET /api/sessions/:id in the teams dashboard: parseFullSession found the session but reading/parsing its full JSONL threw, or serializing the detail response failed.","triggerScenarios":"GET /api/sessions/:id on a session file that exists in the index but is unreadable/corrupt when fully parsed (mid-write file, permission loss).","commonSituations":"Session actively being written by a running teams session; corrupt/truncated JSONL lines; permission changes.","solutions":["Retry after the session finishes writing","Remove or archive the corrupt session file","Check file permissions on the session log"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { detail = await getSession(id); } catch (e) { if (is500(e)) await backoffRetry(); else throw e; }","preventionTips":["Don't inspect sessions while they're actively being written","Retry transient 500s once before surfacing errors"],"tags":["http-500","teams-dashboard","express"],"backgroundTag":"corrupt-session-file","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}