{"record":{"id":"77fecbb5082e0cf8","repo":"eyaltoledano/claude-task-master","slug":"updated-task-missing-required-fields","errorCode":null,"errorMessage":"Updated task missing required fields.","messagePattern":"Updated task missing required fields\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/update-task-by-id.js","lineNumber":480,"sourceCode":"\t\t\t\t\ttelemetryData: aiServiceResponse.telemetryData,\n\t\t\t\t\ttagInfo: aiServiceResponse.tagInfo\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Full update mode: Use structured data directly\n\t\t\tconst aiTask = aiServiceResponse.mainResult?.task;\n\t\t\tif (!aiTask || typeof aiTask !== 'object')\n\t\t\t\tthrow new Error('Received invalid task object from AI.');\n\n\t\t\tconst updatedTask = {\n\t\t\t\t...aiTask,\n\t\t\t\tdependencies: aiTask.dependencies ?? [],\n\t\t\t\tpriority: aiTask.priority ?? null,\n\t\t\t\tdetails: aiTask.details ?? null,\n\t\t\t\ttestStrategy: aiTask.testStrategy ?? null\n\t\t\t};\n\t\t\tif (!updatedTask.title || !updatedTask.description)\n\t\t\t\tthrow new Error('Updated task missing required fields.');\n\t\t\t// Preserve ID if AI changed it\n\t\t\tif (updatedTask.id !== taskId) {\n\t\t\t\treport('warn', `AI changed task ID. Restoring original ID ${taskId}.`);\n\t\t\t\tupdatedTask.id = taskId;\n\t\t\t}\n\t\t\t// Preserve status if AI changed it\n\t\t\tif (\n\t\t\t\tupdatedTask.status !== taskToUpdate.status &&\n\t\t\t\t!prompt.toLowerCase().includes('status')\n\t\t\t) {\n\t\t\t\treport(\n\t\t\t\t\t'warn',\n\t\t\t\t\t`AI changed task status. Restoring original status '${taskToUpdate.status}'.`\n\t\t\t\t);\n\t\t\t\tupdatedTask.status = taskToUpdate.status;\n\t\t\t}\n\t\t\t// Fix subtask IDs if they exist (ensure they are numeric and sequential)\n\t\t\tif (updatedTask.subtasks && Array.isArray(updatedTask.subtasks)) {","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/update-task-by-id.js#L462-L498","documentation":"After building updatedTask from the AI response, updateTaskById validates that title and description are present. The AI must return every required task field; if title or description is missing/empty, the update is aborted to protect tasks.json integrity.","triggerScenarios":"AI response task object lacks title or description (null, undefined, or empty string) even though it is otherwise an object.","commonSituations":"Model omitting required fields in structured output, prompts truncated by context limits, or custom models that don't honor the JSON schema strictly.","solutions":["Retry with a more capable model or --research mode","Verify the task being updated already has title/description so the prompt context is complete","Inspect the raw AI response (debug logs) to confirm which field was dropped","Re-run with a shorter prompt describing the change"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const t = aiServiceResponse?.mainResult?.task;\nif (!t?.title || !t?.description) throw new Error('AI response missing title/description');","typeGuard":"const hasRequiredFields = (t) => typeof t?.title === 'string' && t.title.trim() !== '' && typeof t?.description === 'string' && t.description.trim() !== '';","tryCatchPattern":"try {\n  await updateTaskById(...);\n} catch (e) {\n  if (e.message === 'Updated task missing required fields.') {\n    // retry or fall back to manual edit\n  } else throw e;\n}","preventionTips":["Prefer models with schema-constrained output","Avoid truncation by limiting prompt size","Ensure the original task has complete title/description","Enable debug logging to capture the raw response"],"tags":["ai","validation","schema-mismatch","data-integrity"],"backgroundTag":"invalid-ai-response-schema","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}