{"record":{"id":"d93c0aca8b27ccbd","repo":"davila7/claude-code-templates","slug":"claude-code-projects-directory-not-found-at-this","errorCode":null,"errorMessage":"Claude Code projects directory not found at ${this.projectsDir}","messagePattern":"Claude Code projects directory not found at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli-tool/src/teams-dashboard.js","lineNumber":23,"sourceCode":"const open = require('open');\nconst os = require('os');\nconst readline = require('readline');\n\nclass TeamsDashboard {\n  constructor(options = {}) {\n    this.options = options;\n    this.app = express();\n    this.port = 3338;\n    this.httpServer = null;\n    this.homeDir = os.homedir();\n    this.claudeDir = path.join(this.homeDir, '.claude');\n    this.projectsDir = path.join(this.claudeDir, 'projects');\n    this.sessionCache = new Map();\n  }\n\n  async initialize() {\n    if (!(await fs.pathExists(this.projectsDir))) {\n      throw new Error(`Claude Code projects directory not found at ${this.projectsDir}`);\n    }\n\n    this.sessions = await this.discoverTeamSessions();\n    this.setupWebServer();\n  }\n\n  async discoverTeamSessions() {\n    const sessions = [];\n\n    try {\n      const projectDirs = await fs.readdir(this.projectsDir);\n\n      for (const projectDir of projectDirs) {\n        const projectPath = path.join(this.projectsDir, projectDir);\n        const stat = await fs.stat(projectPath);\n        if (!stat.isDirectory()) continue;\n\n        const entries = await fs.readdir(projectPath);","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/teams-dashboard.js#L5-L41","documentation":"Thrown by TeamsDashboard.initialize() in cli-tool/src/teams-dashboard.js when the Claude Code projects directory (~/.claude/projects by default) does not exist. The dashboard discovers team sessions by scanning that directory, so without it there is nothing to show and initialization aborts.","triggerScenarios":"Instantiating TeamsDashboard and calling initialize() on a machine where Claude Code has never been run (no ~/.claude/projects), or where claudeDir/projectsDir were pointed at a custom non-existent path.","commonSituations":"Running the teams dashboard on a fresh machine or CI box before Claude Code has created any sessions; overriding the Claude directory to a wrong path; HOME env var pointing somewhere unexpected.","solutions":["Run Claude Code once so it creates ~/.claude/projects, then retry","Check the constructor args / env: confirm the claudeDir actually resolves to your Claude config dir (echo $HOME; ls ~/.claude)","mkdir -p <projectsDir> if you only need the dashboard to start with zero sessions"],"exampleFix":"// before\nif (!(await fs.pathExists(this.projectsDir))) {\n  throw new Error(`Claude Code projects directory not found at ${this.projectsDir}`);\n}\n\n// after\nif (!(await fs.pathExists(this.projectsDir))) {\n  await fs.ensureDir(this.projectsDir); // start with an empty dashboard instead of crashing\n}","handlingStrategy":"validation","validationCode":"const fs = require('fs-extra');\nconst path = require('path');\nconst projectsDir = path.join(process.env.HOME, '.claude', 'projects');\nif (!(await fs.pathExists(projectsDir))) {\n  throw new Error('Run Claude Code once first — no ~/.claude/projects directory');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await dashboard.initialize();\n} catch (e) {\n  if (/projects directory not found/.test(e.message)) {\n    await fs.ensureDir(projectsDir);\n    await dashboard.initialize(); // retry with an empty projects dir\n  } else throw e;\n}","preventionTips":["Check for ~/.claude/projects before launching the teams dashboard","Run Claude Code at least once on new machines/CI before dashboards that scan sessions"],"tags":["filesystem","initialization","missing-directory","claude-code"],"backgroundTag":"missing-directory","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}