davila7/claude-code-templates · error

Failed to load communications

Error message

Failed to load communications

What it means

Catch-all HTTP 500 for the communications route: session parsed but accessing session.communications.length threw (communications undefined) or JSON serialization failed.

Source

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

          hasMore: start + pageSize < session.events.length
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load timeline' });
      }
    });

    // Communications
    this.app.get('/api/sessions/:id/communications', 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({
          communications: session.communications,
          count: session.communications.length
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load communications' });
      }
    });

    // Tasks
    this.app.get('/api/sessions/:id/tasks', 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({
          tasks: session.tasks,
          count: session.tasks.length
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load tasks' });
      }
    });

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Update/restart the dashboard so the parser fills defaults
  2. Guard with (session.communications || []) — or remove the problematic session file
  3. Check /api/sessions/:id output shape

Example fix

// before
communications: session.communications,
count: session.communications.length
// after
communications: session.communications || [],
count: (session.communications || []).length
Defensive patterns

Strategy: fallback

Validate before calling

const detail = await fetch(`/api/sessions/${id}`).then(r => r.json());
if (!Array.isArray(detail.communications)) fallbackToEmpty();

Type guard

const hasComms = (s) => Array.isArray(s?.communications);

Try / catch

try { comms = await getComms(id); } catch { comms = { communications: [], count: 0 }; }

Prevention

When it happens

Trigger: GET /api/sessions/:id/communications where the parser omitted the communications field (older session format or empty log).

Common situations: Sessions produced by an older CLI version lacking teammate messaging; partially written logs.

Related errors


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