davila7/claude-code-templates · warning
Warning: Error discovering team sessions
Error message
Warning: Error discovering team sessions
What it means
discoverTeamSessions swallows any error during discovery of Claude team session directories and returns the sessions found so far (possibly empty). The warning means walking ~/.claude team/session data threw unexpectedly.
Source
Thrown at cli-tool/src/teams-dashboard.js:78
if (!isTeam) continue;
// Read metadata efficiently: first/last lines only
const metadata = await this.readSessionMetadata(entryPath, subagentsDir, agentFiles);
sessions.push({
id: entry,
projectDir,
projectName: this.decodeProjectDir(projectDir),
path: entryPath,
subagentsDir,
agentFiles,
agentCount: agentFiles.length,
...metadata
});
}
}
} catch (error) {
console.warn(chalk.yellow('Warning: Error discovering team sessions'), error.message);
}
// Sort newest first
sessions.sort((a, b) => new Date(b.startTime || 0) - new Date(a.startTime || 0));
return sessions;
}
decodeProjectDir(encoded) {
// Convert "-Users-macbookpro16-Documents-..." to a readable path
return encoded.replace(/^-/, '/').replace(/-/g, '/');
}
async detectTeamProtocol(leadFilePath) {
// Scan lead JSONL for Team protocol tool_use: TeamCreate or SendMessage
// These are the definitive signals — teammate-message XML can appear in documentation text
if (!(await fs.pathExists(leadFilePath))) return false;
try {View on GitHub (pinned to a0851ed10c)
Solutions
- Inspect ~/.claude team session directories for corrupted/unreadable files
- Fix ownership/permissions on the ~/.claude tree
- Update the CLI to the latest version in case the session layout changed
- Move aside corrupted session folders to let discovery succeed
Defensive patterns
Strategy: try-catch
Validate before calling
await fs.pathExists(path.join(os.homedir(), '.claude')); // sanity-check the sessions root before invoking the dashboard
Try / catch
try { const sessions = await discoverTeamSessions(); } catch (e) { /* already swallowed internally; expect possibly-empty array */ } Prevention
- Keep ~/.claude owned by your user
- Avoid running the dashboard while sessions are being written heavily
When it happens
Trigger: Readdir/stat failure on the sessions root, unreadable session metadata files, or a malformed metadata JSON causing a throw inside the loop that isn't individually caught.
Common situations: Corrupted session folders, permission changes on ~/.claude, sessions being written concurrently by another Claude process, or a fresh install with unexpected directory layout after a version change.
Related errors
- No files were copied from Cloudflare component directory
- Claude Code projects directory not found at ${this.projectsD
- Failed to load skill
- File not found
- Failed to load file
AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28).
Data as JSON: /api/errors/b9532ee944b3975e.
Report an issue: GitHub.