{"record":{"id":"b9532ee944b3975e","repo":"davila7/claude-code-templates","slug":"warning-error-discovering-team-sessions","errorCode":null,"errorMessage":"Warning: Error discovering team sessions","messagePattern":"Warning: Error discovering team sessions","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":78,"sourceCode":"          if (!isTeam) continue;\n\n          // Read metadata efficiently: first/last lines only\n          const metadata = await this.readSessionMetadata(entryPath, subagentsDir, agentFiles);\n\n          sessions.push({\n            id: entry,\n            projectDir,\n            projectName: this.decodeProjectDir(projectDir),\n            path: entryPath,\n            subagentsDir,\n            agentFiles,\n            agentCount: agentFiles.length,\n            ...metadata\n          });\n        }\n      }\n    } catch (error) {\n      console.warn(chalk.yellow('Warning: Error discovering team sessions'), error.message);\n    }\n\n    // Sort newest first\n    sessions.sort((a, b) => new Date(b.startTime || 0) - new Date(a.startTime || 0));\n    return sessions;\n  }\n\n  decodeProjectDir(encoded) {\n    // Convert \"-Users-macbookpro16-Documents-...\" to a readable path\n    return encoded.replace(/^-/, '/').replace(/-/g, '/');\n  }\n\n  async detectTeamProtocol(leadFilePath) {\n    // Scan lead JSONL for Team protocol tool_use: TeamCreate or SendMessage\n    // These are the definitive signals — teammate-message XML can appear in documentation text\n    if (!(await fs.pathExists(leadFilePath))) return false;\n\n    try {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L60-L96","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"await fs.pathExists(path.join(os.homedir(), '.claude'));\n// sanity-check the sessions root before invoking the dashboard","typeGuard":null,"tryCatchPattern":"try { const sessions = await discoverTeamSessions(); } catch (e) { /* already swallowed internally; expect possibly-empty array */ }","preventionTips":["Keep ~/.claude owned by your user","Avoid running the dashboard while sessions are being written heavily"],"tags":["filesystem","sessions","discovery"],"backgroundTag":"discovery-scan-failed","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}