{"record":{"id":"2bfb17e7cf88c89e","repo":"davila7/claude-code-templates","slug":"failed-to-load-file","errorCode":null,"errorMessage":"Failed to load file","messagePattern":"Failed to load file","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"cli-tool/src/skill-dashboard.js","lineNumber":435,"sourceCode":"        }\n\n        if (!(await fs.pathExists(fullPath))) {\n          return res.status(404).json({ error: 'File not found' });\n        }\n\n        const content = await fs.readFile(fullPath, 'utf8');\n        const stats = await fs.stat(fullPath);\n\n        res.json({\n          content,\n          path: filePath,\n          size: this.formatFileSize(stats.size),\n          lastModified: stats.mtime,\n          timestamp: new Date().toISOString()\n        });\n      } catch (error) {\n        console.error('Error loading file:', error);\n        res.status(500).json({ error: 'Failed to load file' });\n      }\n    });\n\n    this.app.get('/api/summary', async (req, res) => {\n      try {\n        await this.loadSkillsData();\n        const personalCount = this.skills.filter(s => s.source === 'Personal').length;\n        const projectCount = this.skills.filter(s => s.source === 'Project').length;\n        const pluginCount = this.skills.filter(s => s.source === 'Plugin').length;\n\n        res.json({\n          total: this.skills.length,\n          personal: personalCount,\n          project: projectCount,\n          plugin: pluginCount,\n          timestamp: new Date().toISOString()\n        });\n      } catch (error) {","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/skill-dashboard.js#L417-L453","documentation":"Catch-all HTTP 500 for the skill dashboard file route: thrown when reading or stat-ing the file raises after all 404/403 checks passed (EACCES, EISDIR, EMFILE, unexpected encoding errors).","triggerScenarios":"File replaced by a directory between checks; too many open files (EMFILE); permission changes mid-request; binary read forced as utf8 in a failing environment.","commonSituations":"Long-running dashboard with file descriptor leaks; concurrent edits to skill files; restrictive umask.","solutions":["Read the server console 'Error loading file:' log for the errno","Fix permissions or reduce open file pressure / restart dashboard","Ensure requested paths are files, not directories"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const r = await fetch(fileUrl); if (r.status === 500) showRetryable(); } catch { offline(); }","preventionTips":["Monitor server logs for 'Error loading file'","Avoid requesting directories as files"],"tags":["http-500","filesystem","express","skill-dashboard"],"backgroundTag":"file-read-permission-denied","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}