davila7/claude-code-templates · error

Failed to load teammate

Error message

Failed to load teammate

What it means

Catch-all HTTP 500 for the teammate detail route: agent resolved but filtering events or spreading/serializing the agent object threw (circular references, unexpected event shapes).

Source

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

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

        const agent = session.agents[req.params.agentId];
        if (!agent) return res.status(404).json({ error: 'Agent not found' });

        // Get agent-specific events
        const agentEvents = session.events
          .filter(e => e.agentId === req.params.agentId)
          .slice(0, 100);

        res.json({
          ...agent,
          recentEvents: agentEvents
        });
      } catch (error) {
        res.status(500).json({ error: 'Failed to load teammate' });
      }
    });

    // Main route
    this.app.get('/', (req, res) => {
      res.sendFile(path.join(__dirname, 'teams-dashboard-web', 'index.html'));
    });
  }

  async startServer() {
    return new Promise((resolve) => {
      this.httpServer = this.app.listen(this.port, async () => {
        console.log(chalk.green(`Teams dashboard started at http://localhost:${this.port}`));
        resolve();
      });
    });
  }

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Inspect the same agent via /api/sessions/:id raw output
  2. Remove/repair the session file or re-parse by restarting
  3. Guard filters against malformed events
Defensive patterns

Strategy: try-catch

Try / catch

try { mate = await getTeammate(id, agentId); } catch { showAgentSummaryOnly(agentId); }

Prevention

When it happens

Trigger: GET /api/sessions/:id/teammates/:agentId where session.events entries lack expected fields or agent object contains non-serializable/circular data.

Common situations: Parser output changes between dashboard versions; partially corrupt session data.

Related errors


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