davila7/claude-code-templates · warning

File not found

Error message

File not found

What it means

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.

Source

Thrown at cli-tool/src/skill-dashboard.js:420

        const skill = this.skills.find(s =>
          s.name === skillName ||
          s.name.toLowerCase().replace(/\s+/g, '-') === skillName.toLowerCase()
        );

        if (!skill) {
          return res.status(404).json({ error: 'Skill not found' });
        }

        const fullPath = path.join(skill.path, filePath);

        // Security check: ensure the file is within the skill directory
        const normalizedPath = path.normalize(fullPath);
        if (!normalizedPath.startsWith(skill.path)) {
          return res.status(403).json({ error: 'Access denied' });
        }

        if (!(await fs.pathExists(fullPath))) {
          return res.status(404).json({ error: 'File not found' });
        }

        const content = await fs.readFile(fullPath, 'utf8');
        const stats = await fs.stat(fullPath);

        res.json({
          content,
          path: filePath,
          size: this.formatFileSize(stats.size),
          lastModified: stats.mtime,
          timestamp: new Date().toISOString()
        });
      } catch (error) {
        console.error('Error loading file:', error);
        res.status(500).json({ error: 'Failed to load file' });
      }
    });

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Re-fetch the skill's file listing to get current paths
  2. Check the file exists on disk under skill.path
  3. Fix the relative path (no leading slash, correct subdirectory)
Defensive patterns

Strategy: validation

Validate before calling

const listing = await (await fetch(`/api/skills/${slug}`)).json();
if (!listing.files?.some(f => f.path === rel)) throw new Error('file not in listing');

Prevention

When it happens

Trigger: 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).

Common situations: Stale UI file listing after editing a skill; typos in relative path; skill folder restructured.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of davila7/claude-code-templates@a0851ed10c (2026-08-28). Data as JSON: /api/errors/9253fe5bcb0b3332. Report an issue: GitHub.