eyaltoledano/claude-task-master · error
Task status is required
Error message
Task status is required
What it means
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.
Source
Thrown at packages/tm-core/src/common/interfaces/storage.interface.ts:462
}
/**
* Utility method to validate task data before storage operations
* @param task - Task to validate
* @throws Error if task is invalid
*/
protected validateTask(task: Task): void {
if (!task.id) {
throw new Error('Task ID is required');
}
if (!task.title) {
throw new Error('Task title is required');
}
if (!task.description) {
throw new Error('Task description is required');
}
if (!task.status) {
throw new Error('Task status is required');
}
}
/**
* Utility method to sanitize tag names for file system safety
* @param tag - Tag name to sanitize
* @returns Sanitized tag name
*/
protected sanitizeTag(tag: string): string {
return tag.replace(/[^a-zA-Z0-9-_]/g, '-').toLowerCase();
}
}
View on GitHub (pinned to c0c98d367c)
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
Example fix
// before
await storage.createTask({ id: 7, title: 'Write docs', description: 'API docs' });
// after
await storage.createTask({ id: 7, title: 'Write docs', description: 'API docs', status: 'pending' }); Defensive patterns
Strategy: validation
Validate before calling
const VALID_STATUSES = ['pending','in-progress','done','blocked','cancelled'];
if (!task?.status) throw new Error('task.status must be set before saving');
if (!VALID_STATUSES.includes(task.status)) throw new Error(`invalid status: ${task.status}`); Type guard
function hasStatus(task): task is Task & { status: string } {
return !!task && typeof task.status === 'string' && task.status.length > 0;
} Try / catch
try {
await storage.createTask(task);
} catch (err) {
if (err instanceof Error && err.message === 'Task status is required') {
console.error('Set task.status (e.g. "pending") before persisting.');
return;
}
throw err;
} Prevention
- 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
When it happens
Trigger: Creating or saving a task object that omits status, or has status set to null/undefined/''.
Common situations: 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.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- Task description is required
- Task ID is required
- Task title is required
- Task ${taskId} not found
- INVALID_SOURCE_TAG
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/3df2445f0e31fb35.
Report an issue: GitHub.