davila7/claude-code-templates · error
Failed to load sessions
Error message
Failed to load sessions
What it means
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.
Source
Thrown at cli-tool/src/teams-dashboard.js:657
this.app.get('/api/sessions', async (req, res) => {
try {
this.sessions = await this.discoverTeamSessions();
res.json({
sessions: this.sessions.map(s => ({
id: s.id,
projectName: s.projectName,
agentCount: s.agentCount,
startTime: s.startTime,
endTime: s.endTime,
duration: s.duration,
gitBranch: s.gitBranch,
teammateNames: s.teammateNames
})),
count: this.sessions.length,
timestamp: new Date().toISOString()
});
} catch (error) {
res.status(500).json({ error: 'Failed to load sessions' });
}
});
// Global summary stats
this.app.get('/api/summary', async (req, res) => {
try {
res.json({
totalSessions: this.sessions.length,
totalAgents: this.sessions.reduce((sum, s) => sum + s.agentCount, 0),
timestamp: new Date().toISOString()
});
} catch (error) {
res.status(500).json({ error: 'Failed to load summary' });
}
});
// Full session detail (triggers parse)
this.app.get('/api/sessions/:id', async (req, res) => {View on GitHub (pinned to a0851ed10c)
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
Example fix
// before
} catch (error) {
res.status(500).json({ error: 'Failed to load sessions' });
}
// after
} catch (error) {
console.error('Failed to load sessions:', error);
res.status(500).json({ error: 'Failed to load sessions', detail: String(error) });
} Defensive patterns
Strategy: try-catch
Try / catch
try { const r = await fetch('/api/sessions'); if (!r.ok) throw new Error((await r.json()).error); } catch (e) { showError(e); } Prevention
- Back up session JSONL files
- Log the underlying error server-side for diagnosis
When it happens
Trigger: GET /api/sessions when session discovery hits an unreadable file, malformed JSONL, or a missing teams data directory.
Common situations: Corrupt session log files from a crashed run; permissions on the Claude data dir; dashboard started with a changed HOME.
Related errors
- Failed to load summary
- Failed to load session
- Failed to load communications
- Failed to load tasks
- Failed to load teammate
AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28).
Data as JSON: /api/errors/16b0aaafb5351dee.
Report an issue: GitHub.