davila7/claude-code-templates · error

Failed to load session

Error message

Failed to load session

What it means

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.

Source

Thrown at cli-tool/src/teams-dashboard.js:692

    // Full session detail (triggers parse)
    this.app.get('/api/sessions/:id', async (req, res) => {
      try {
        const session = await this.parseFullSession(req.params.id);
        if (!session) return res.status(404).json({ error: 'Session not found' });

        res.json({
          id: session.id,
          projectName: session.projectName,
          gitBranch: session.gitBranch,
          startTime: session.startTime,
          endTime: session.endTime,
          duration: session.duration,
          agents: session.agents,
          teammateNames: session.teammateNames,
          stats: session.stats
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load session' });
      }
    });

    // Timeline (paginated)
    this.app.get('/api/sessions/:id/timeline', async (req, res) => {
      try {
        const session = await this.parseFullSession(req.params.id);
        if (!session) return res.status(404).json({ error: 'Session not found' });

        const page = parseInt(req.query.page) || 0;
        const pageSize = parseInt(req.query.pageSize) || 50;
        const start = page * pageSize;
        const events = session.events.slice(start, start + pageSize);

        res.json({
          events,
          total: session.events.length,
          page,

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Retry after the session finishes writing
  2. Remove or archive the corrupt session file
  3. Check file permissions on the session log
Defensive patterns

Strategy: retry

Try / catch

try { detail = await getSession(id); } catch (e) { if (is500(e)) await backoffRetry(); else throw e; }

Prevention

When it happens

Trigger: 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).

Common situations: Session actively being written by a running teams session; corrupt/truncated JSONL lines; permission changes.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/e3538ae5b6b4d119. Report an issue: GitHub.