{"record":{"id":"39c0ffecef8ac5db","repo":"davila7/claude-code-templates","slug":"please-provide-a-detailed-prompt-at-least-10-char","errorCode":null,"errorMessage":"Please provide a detailed prompt (at least 10 characters)","messagePattern":"Please provide a detailed prompt \\(at least 10 characters\\)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"cli-tool/src/sandbox-server.js","lineNumber":138,"sourceCode":"app.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 = {\n        id: taskId,\n        title: prompt.substring(0, 60) + (prompt.length > 60 ? '...' : ''),\n        prompt: prompt.trim(),\n        agent: agent,\n        mode: mode,\n        status: 'running',\n        startTime: new Date(),\n        progress: 0,\n        output: [],","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/davila7/claude-code-templates/blob/a0851ed10c7c60463dac8cfaaca124cf32d5804d/cli-tool/src/sandbox-server.js#L120-L156","documentation":"POST /api/execute requires a non-empty prompt of at least 10 characters in the request body. The endpoint destructures { prompt } from req.body and returns 400 with this message when prompt is missing, empty, or shorter than 10 characters after trimming.","triggerScenarios":"POST /api/execute with body {\"prompt\":\"hi\"}, {\"prompt\":\"\"}, or with no prompt field at all; also a request without JSON content-type so req.body.prompt is undefined.","commonSituations":"Client sends a placeholder or test prompt; forgetting to set Content-Type: application/json so the body is not parsed; sending a prompt field with a whitespace-only string.","solutions":["Send a prompt of at least 10 non-whitespace characters in the JSON body","Ensure the request includes header Content-Type: application/json so Express parses req.body","Validate prompt length client-side before calling the endpoint"],"exampleFix":"// before\nawait fetch(`${base}/api/execute`, {\n  method: 'POST',\n  body: JSON.stringify({ prompt: 'test' })\n});\n// after\nawait fetch(`${base}/api/execute`, {\n  method: 'POST',\n  headers: { 'Content-Type': 'application/json' },\n  body: JSON.stringify({ prompt: 'Refactor the login form to use React hooks' })\n});","handlingStrategy":"validation","validationCode":"function isValidPrompt(p) {\n  return typeof p === 'string' && p.trim().length >= 10;\n}\nif (!isValidPrompt(prompt)) throw new Error('prompt must be >= 10 chars');","typeGuard":"const isValidPrompt = (p) => typeof p === 'string' && p.trim().length >= 10;","tryCatchPattern":null,"preventionTips":["Validate prompt length client-side before POSTing","Always send Content-Type: application/json","Trim user input before length checks"],"tags":["http-400","validation","prompt-length","express"],"backgroundTag":"request-validation-failed","analyzedSha":"a0851ed10c7c60463dac8cfaaca124cf32d5804d","analyzedAt":"2026-08-28T14:11:56.058Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}