{"record":{"id":"de527e67b12e5c7b","repo":"davila7/claude-code-templates","slug":"components-file-not-found","errorCode":null,"errorMessage":"Components file not found","messagePattern":"Components file not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"cli-tool/src/sandbox-server.js","lineNumber":129,"sourceCode":"                    </pre>\n                </body>\n            </html>\n        `);\n    }\n});\n\n// Serve static files for CSS, JS, etc. (but not index.html at root)\napp.use('/css', express.static(path.join(__dirname, '../../docs/css')));\napp.use('/js', express.static(path.join(__dirname, '../../docs/js')));\napp.use('/assets', express.static(path.join(__dirname, '../../docs/assets')));\n\n// Serve components.json for agent autocomplete\napp.get('/components.json', (req, res) => {\n    const componentsPath = path.join(__dirname, '../../docs/components.json');\n    if (fs.existsSync(componentsPath)) {\n        res.sendFile(componentsPath);\n    } else {\n        res.status(404).json({ error: 'Components file not found' });\n    }\n});\n\n// API endpoint to execute task (local or cloud)\napp.post('/api/execute', async (req, res) => {\n    const { prompt, mode = 'local', agent = 'development-team/frontend-developer' } = req.body;\n    \n    if (!prompt || prompt.trim().length < 10) {\n        return res.status(400).json({\n            success: false,\n            error: 'Please provide a detailed prompt (at least 10 characters)'\n        });\n    }\n    \n    const taskId = `task-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;\n    \n    // Create task object\n    const task = {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/sandbox-server.js#L111-L147","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run python scripts/generate_components_json.py from the repo root to (re)generate docs/components.json","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","Verify with ls docs/components.json that the path resolves from cli-tool/src/"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const res = await fetch(`${base}/components.json`);\nif (!res.ok) {\n  // catalog missing — generate it: python scripts/generate_components_json.py\n  console.error('Catalog unavailable, run the generator script');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run python scripts/generate_components_json.py before starting the sandbox server","Always start the server from the repository root so the ../../docs relative path resolves","Add a startup check that warns if docs/components.json is missing"],"tags":["http-404","missing-file","catalog","sandbox-server"],"backgroundTag":"file-not-found","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}