{"record":{"id":"3df2445f0e31fb35","repo":"eyaltoledano/claude-task-master","slug":"task-status-is-required","errorCode":null,"errorMessage":"Task status is required","messagePattern":"Task status is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/common/interfaces/storage.interface.ts","lineNumber":462,"sourceCode":"\t}\n\n\t/**\n\t * Utility method to validate task data before storage operations\n\t * @param task - Task to validate\n\t * @throws Error if task is invalid\n\t */\n\tprotected validateTask(task: Task): void {\n\t\tif (!task.id) {\n\t\t\tthrow new Error('Task ID is required');\n\t\t}\n\t\tif (!task.title) {\n\t\t\tthrow new Error('Task title is required');\n\t\t}\n\t\tif (!task.description) {\n\t\t\tthrow new Error('Task description is required');\n\t\t}\n\t\tif (!task.status) {\n\t\t\tthrow new Error('Task status is required');\n\t\t}\n\t}\n\n\t/**\n\t * Utility method to sanitize tag names for file system safety\n\t * @param tag - Tag name to sanitize\n\t * @returns Sanitized tag name\n\t */\n\tprotected sanitizeTag(tag: string): string {\n\t\treturn tag.replace(/[^a-zA-Z0-9-_]/g, '-').toLowerCase();\n\t}\n}\n","sourceCodeStart":444,"sourceCodeEnd":475,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/common/interfaces/storage.interface.ts#L444-L475","documentation":"This error is thrown by validateTask in the storage interface when a task object has no status property. Status drives task tracking and transitions, so Task Master refuses to persist a task without one. Like the other validateTask checks it is a falsy check: null, undefined, and empty string all trigger it.","triggerScenarios":"Creating or saving a task object that omits status, or has status set to null/undefined/''.","commonSituations":"Hand-constructed task objects in scripts; deserializing tasks from external formats that lack status; refactors that renamed the status field (e.g. state or stage) leaving it unset; bulk imports with malformed rows.","solutions":["Set an explicit valid status (e.g. 'pending') on the task before persisting","Validate that task.status is present before calling the storage API","Fix field-mapping/import code that fails to copy status from the source data","Inspect version-migration code in case a rename left status undefined"],"exampleFix":"// before\nawait storage.createTask({ id: 7, title: 'Write docs', description: 'API docs' });\n// after\nawait storage.createTask({ id: 7, title: 'Write docs', description: 'API docs', status: 'pending' });","handlingStrategy":"validation","validationCode":"const VALID_STATUSES = ['pending','in-progress','done','blocked','cancelled'];\nif (!task?.status) throw new Error('task.status must be set before saving');\nif (!VALID_STATUSES.includes(task.status)) throw new Error(`invalid status: ${task.status}`);","typeGuard":"function hasStatus(task): task is Task & { status: string } {\n  return !!task && typeof task.status === 'string' && task.status.length > 0;\n}","tryCatchPattern":"try {\n  await storage.createTask(task);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Task status is required') {\n    console.error('Set task.status (e.g. \"pending\") before persisting.');\n    return;\n  }\n  throw err;\n}","preventionTips":["Always initialize status to 'pending' when creating task objects","Type the status field as a non-optional union so TypeScript rejects missing status","Check import/migration mappers copy the status field","Test deserialization paths for tasks coming from external formats"],"tags":["validation","storage","task-management"],"backgroundTag":"missing-required-field","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}