{"record":{"id":"9253fe5bcb0b3332","repo":"davila7/claude-code-templates","slug":"file-not-found","errorCode":null,"errorMessage":"File not found","messagePattern":"File not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"cli-tool/src/skill-dashboard.js","lineNumber":420,"sourceCode":"        const skill = this.skills.find(s =>\n          s.name === skillName ||\n          s.name.toLowerCase().replace(/\\s+/g, '-') === skillName.toLowerCase()\n        );\n\n        if (!skill) {\n          return res.status(404).json({ error: 'Skill not found' });\n        }\n\n        const fullPath = path.join(skill.path, filePath);\n\n        // Security check: ensure the file is within the skill directory\n        const normalizedPath = path.normalize(fullPath);\n        if (!normalizedPath.startsWith(skill.path)) {\n          return res.status(403).json({ error: 'Access denied' });\n        }\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","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/skill-dashboard.js#L402-L438","documentation":"HTTP 404 from the skill dashboard file route when the requested path is inside the skill directory but fs.pathExists returns false — the file simply isn't there.","triggerScenarios":"GET /api/skills/x/file/missing.md; frontend cached a file listing and the file was renamed/deleted; wrong relative path (e.g. leading slash or wrong subfolder).","commonSituations":"Stale UI file listing after editing a skill; typos in relative path; skill folder restructured.","solutions":["Re-fetch the skill's file listing to get current paths","Check the file exists on disk under skill.path","Fix the relative path (no leading slash, correct subdirectory)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const listing = await (await fetch(`/api/skills/${slug}`)).json();\nif (!listing.files?.some(f => f.path === rel)) throw new Error('file not in listing');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refresh the file listing before opening files","Avoid hardcoded file paths in UI code"],"tags":["http-404","filesystem","skill-dashboard"],"backgroundTag":"file-not-found","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}