{"record":{"id":"19a5d94c864b642e","repo":"eyaltoledano/claude-task-master","slug":"manual-task-data-must-include-at-least-a-title-and","errorCode":null,"errorMessage":"Manual task data must include at least a title and description.","messagePattern":"Manual task data must include at least a title and description\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/add-task.js","lineNumber":359,"sourceCode":"\t\t\tallRelatedTaskIds.add(taskId);\n\t\t}\n\n\t\tlet taskData;\n\n\t\t// Check if manual task data is provided\n\t\tif (manualTaskData) {\n\t\t\treport('Using manually provided task data', 'info');\n\t\t\ttaskData = manualTaskData;\n\t\t\treport('DEBUG: Taking MANUAL task data path.', 'debug');\n\n\t\t\t// Basic validation for manual data\n\t\t\tif (\n\t\t\t\t!taskData.title ||\n\t\t\t\ttypeof taskData.title !== 'string' ||\n\t\t\t\t!taskData.description ||\n\t\t\t\ttypeof taskData.description !== 'string'\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Manual task data must include at least a title and description.'\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\treport('DEBUG: Taking AI task generation path.', 'debug');\n\t\t\t// --- Refactored AI Interaction ---\n\t\t\treport(`Generating task data with AI with prompt:\\n${prompt}`, 'info');\n\n\t\t\t// --- Use the new ContextGatherer ---\n\t\t\tconst contextGatherer = new ContextGatherer(projectRoot, tag);\n\t\t\tconst gatherResult = await contextGatherer.gather({\n\t\t\t\tsemanticQuery: prompt,\n\t\t\t\tdependencyTasks: numericDependencies,\n\t\t\t\tformat: 'research'\n\t\t\t});\n\n\t\t\tconst gatheredContext = gatherResult.context;\n\t\t\tconst analysisData = gatherResult.analysisData;","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/add-task.js#L341-L377","documentation":"addTask() validates manually supplied task data before persisting it. When the user chose the manual path (no --prompt / AI generation), it requires both a non-empty string title and a non-empty string description. If either is missing, empty, or of the wrong type, it refuses to create a malformed task.","triggerScenarios":"Calling addTask() with { prompt: null } (or no prompt) so the manual branch runs, while passing taskData whose title or description is undefined, an empty string, or a non-string (e.g. a number).","commonSituations":"CLI invocation like `task-master add-task` without --prompt and without --title/--description; MCP tool call where the client omitted the description field; programmatic use where a form/JSON payload had title but no description.","solutions":["Provide both a title and a description as non-empty strings in taskData.","If you intended AI generation, pass a prompt (e.g. --prompt \"...\") so the AI path runs instead of the manual validation.","Validate/sanitize the incoming task payload before calling addTask(), coercing non-string fields to strings or rejecting them."],"exampleFix":"// before\nawait addTask(tasksPath, { prompt: null, taskData: { title: 'Setup CI' } });\n// after\nawait addTask(tasksPath, { prompt: null, taskData: { title: 'Setup CI', description: 'Add GitHub Actions workflow for tests' } });","handlingStrategy":"validation","validationCode":"if (typeof title !== 'string' || !title.trim() || typeof description !== 'string' || !description.trim()) {\n  throw new TypeError('Both title and description are required non-empty strings');\n}\nawait addTask(tasksPath, { taskData: { title, description } });","typeGuard":"function isManualTaskData(v) {\n  return !!v && typeof v.title === 'string' && v.title.length > 0 && typeof v.description === 'string' && v.description.length > 0;\n}","tryCatchPattern":"try {\n  await addTask(tasksPath, { taskData });\n} catch (err) {\n  if (err.message.includes('must include at least a title and description')) {\n    console.error('Missing/invalid title or description:', taskData);\n  } else throw err;\n}","preventionTips":["Always pass both title and description when omitting a prompt.","Validate user-supplied form/JSON payloads before calling addTask.","Use one path: either provide a prompt (AI) or full manual data, never neither."],"tags":["validation","input-validation","add-task"],"backgroundTag":"missing-required-field","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}