davila7/claude-code-templates · error

Failed to load file

Error message

Failed to load file

What it means

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

Source

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

        }

        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' });
      }
    });

    this.app.get('/api/summary', async (req, res) => {
      try {
        await this.loadSkillsData();
        const personalCount = this.skills.filter(s => s.source === 'Personal').length;
        const projectCount = this.skills.filter(s => s.source === 'Project').length;
        const pluginCount = this.skills.filter(s => s.source === 'Plugin').length;

        res.json({
          total: this.skills.length,
          personal: personalCount,
          project: projectCount,
          plugin: pluginCount,
          timestamp: new Date().toISOString()
        });
      } catch (error) {

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Read the server console 'Error loading file:' log for the errno
  2. Fix permissions or reduce open file pressure / restart dashboard
  3. Ensure requested paths are files, not directories
Defensive patterns

Strategy: try-catch

Try / catch

try { const r = await fetch(fileUrl); if (r.status === 500) showRetryable(); } catch { offline(); }

Prevention

When it happens

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

Common situations: Long-running dashboard with file descriptor leaks; concurrent edits to skill files; restrictive umask.

Related errors


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