eyaltoledano/claude-task-master · error

Task title is required

Error message

Task title is required

What it means

The same validateTask guard throws this error when a Task has an id but its `title` is missing, null, or empty. Titles are treated as mandatory task metadata, so storage operations refuse tasks without them.

Source

Thrown at packages/tm-core/src/common/interfaces/storage.interface.ts:456

	protected generateBackupPath(originalPath: string): string {
		const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
		const parts = originalPath.split('.');
		const extension = parts.pop();
		const baseName = parts.join('.');
		return `${baseName}.backup.${timestamp}.${extension}`;
	}

	/**
	 * 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

  1. Ensure `title` is set (non-empty string) before calling the storage method.
  2. Map/rename external fields (name/summary) to `title` during ingestion.
  3. Add form/input validation requiring a title before task creation.
  4. Provide a fallback title (e.g. 'Untitled task') if downstream data legitimately lacks one.

Example fix

// before
await storage.saveTask({ id: 1, title: '', description: 'd', status: 'pending' });
// after
await storage.saveTask({ id: 1, title: 'Fix login bug', description: 'd', status: 'pending' });
Defensive patterns

Strategy: validation

Validate before calling

if (typeof task.title !== 'string' || task.title.trim() === '') throw new Error('A non-empty title is required');

Type guard

function hasTitle(t) { return typeof t?.title === 'string' && t.title.trim().length > 0; }

Try / catch

try { await storage.saveTask(task); } catch (e) { if (e.message === 'Task title is required') { throw new InvalidTaskError('title', task); } throw e; }

Prevention

When it happens

Trigger: Calling storage methods with a Task whose `title` is undefined/empty — e.g. tasks created from user input where the title field was never filled, or mapped from external systems that use a different field name (name, summary).

Common situations: UI/form flows allowing empty submissions; import scripts mapping `name` instead of `title`; JSON payloads with omitted optional-looking fields; AI-generated tasks missing a title key.

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


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/91e54ab36c78ea23. Report an issue: GitHub.