davila7/claude-code-templates · warning

Components file not found

Error message

Components file not found

What it means

The sandbox server's /components.json route serves docs/components.json for agent autocomplete. It returns 404 when the file does not exist at cli-tool/../../docs/components.json. This happens when the generated catalog has not been produced or the server is run from a layout where the relative path doesn't resolve.

Source

Thrown at cli-tool/src/sandbox-server.js:129

                    </pre>
                </body>
            </html>
        `);
    }
});

// Serve static files for CSS, JS, etc. (but not index.html at root)
app.use('/css', express.static(path.join(__dirname, '../../docs/css')));
app.use('/js', express.static(path.join(__dirname, '../../docs/js')));
app.use('/assets', express.static(path.join(__dirname, '../../docs/assets')));

// Serve components.json for agent autocomplete
app.get('/components.json', (req, res) => {
    const componentsPath = path.join(__dirname, '../../docs/components.json');
    if (fs.existsSync(componentsPath)) {
        res.sendFile(componentsPath);
    } else {
        res.status(404).json({ error: 'Components file not found' });
    }
});

// API endpoint to execute task (local or cloud)
app.post('/api/execute', async (req, res) => {
    const { prompt, mode = 'local', agent = 'development-team/frontend-developer' } = req.body;
    
    if (!prompt || prompt.trim().length < 10) {
        return res.status(400).json({
            success: false,
            error: 'Please provide a detailed prompt (at least 10 characters)'
        });
    }
    
    const taskId = `task-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
    
    // Create task object
    const task = {

View on GitHub (pinned to a0851ed10c)

Solutions

  1. Run python scripts/generate_components_json.py from the repo root to (re)generate docs/components.json
  2. If running from an installed package, run the server from a clone of the repository instead, or copy components.json to the expected relative location
  3. Verify with ls docs/components.json that the path resolves from cli-tool/src/
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`${base}/components.json`);
if (!res.ok) {
  // catalog missing — generate it: python scripts/generate_components_json.py
  console.error('Catalog unavailable, run the generator script');
}

Prevention

When it happens

Trigger: GET /components.json when docs/components.json is missing — e.g. fresh clone where python scripts/generate_components_json.py was never run, or running the server from an installed npm package layout where ../../docs/ doesn't exist.

Common situations: Fresh clone without running the catalog generator; running sandbox-server.js from a globally installed package (npm install -g) where docs/ is not shipped; CI environments that skip generating docs/components.json.

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/de527e67b12e5c7b. Report an issue: GitHub.