eyaltoledano/claude-task-master · error

All tasks parameter must be an array

Error message

All tasks parameter must be an array

What it means

A guard in dependency-manager's tag-move logic: the allTasks parameter (the full task collection used to look up the source task) must be an array. Passing anything else (object, null, undefined, map of tag->tasks) is rejected before lookup begins. Note this is a plain Error, not a coded DependencyError.

Source

Thrown at scripts/modules/dependency-manager.js:1758

 * @param {Array} allTasks - Array of all tasks from all tags
 * @returns {Object} Object with canMove boolean and dependentTaskIds array
 */
function canMoveWithDependencies(taskId, sourceTag, targetTag, allTasks) {
	// Parameter validation
	if (!taskId || typeof taskId !== 'string') {
		throw new Error('Task ID must be a valid string');
	}

	if (!sourceTag || typeof sourceTag !== 'string') {
		throw new Error('Source tag must be a valid string');
	}

	if (!targetTag || typeof targetTag !== 'string') {
		throw new Error('Target tag must be a valid string');
	}

	if (!Array.isArray(allTasks)) {
		throw new Error('All tasks parameter must be an array');
	}

	// Enhanced task lookup to handle subtasks properly
	let sourceTask = null;

	// Check if it's a subtask ID (e.g., "1.2")
	if (taskId.includes('.')) {
		const [parentId, subtaskId] = taskId
			.split('.')
			.map((id) => parseInt(id, 10));
		const parentTask = allTasks.find(
			(t) => t.id === parentId && t.tag === sourceTag
		);

		if (
			parentTask &&
			parentTask.subtasks &&
			Array.isArray(parentTask.subtasks)

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the array of task objects for the relevant tag, e.g. data.tasks or data.tags[currentTag].
  2. If you have tagged data, select the right tag's array before calling.
  3. Ensure the preceding readTasks/getTasks call succeeded and returned an array.
  4. Add Array.isArray(allTasks) checks at the call site to fail early with a clearer message.

Example fix

// before
moveTaskBetweenTags('5.2', 'feature-x', taggedData);
// after
moveTaskBetweenTags('5.2', 'feature-x', taggedData.tags['feature-x'] ?? taggedData.tasks);
Defensive patterns

Strategy: type-guard

Validate before calling

function getTaskArrayForTag(taggedData, tag) {
  const tasks = taggedData?.tags?.[tag] ?? taggedData?.tasks;
  if (!Array.isArray(tasks)) throw new TypeError(`Expected an array of tasks for tag '${tag}'`);
  return tasks;
}

Type guard

const isTaskArray = (v) => Array.isArray(v) && v.every(t => t && typeof t === 'object' && 'id' in t);

Try / catch

if (!isTaskArray(allTasks)) {
  throw new TypeError('moveTaskBetweenTags expects an array of task objects (the tag\'s task list), not tagged data or null');
}

Prevention

When it happens

Trigger: Calling the move-between-tags function programmatically with allTasks as an object keyed by tag, a TaggedTasks structure, null, or the result of a failed read; essentially any non-array where the flattened task list is expected.

Common situations: Passing the whole tagged tasks data file ({ master: [...], feature: [...] }) instead of the array for the current tag, passing undefined after a failed getTasks call, or mismating an MCP/CLI refactor that changed the parameter shape.

Related errors


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