{"record":{"id":"76974952583f2ef7","repo":"eyaltoledano/claude-task-master","slug":"all-tasks-parameter-must-be-an-array","errorCode":null,"errorMessage":"All tasks parameter must be an array","messagePattern":"All tasks parameter must be an array","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/dependency-manager.js","lineNumber":1758,"sourceCode":" * @param {Array} allTasks - Array of all tasks from all tags\n * @returns {Object} Object with canMove boolean and dependentTaskIds array\n */\nfunction canMoveWithDependencies(taskId, sourceTag, targetTag, allTasks) {\n\t// Parameter validation\n\tif (!taskId || typeof taskId !== 'string') {\n\t\tthrow new Error('Task ID must be a valid string');\n\t}\n\n\tif (!sourceTag || typeof sourceTag !== 'string') {\n\t\tthrow new Error('Source tag must be a valid string');\n\t}\n\n\tif (!targetTag || typeof targetTag !== 'string') {\n\t\tthrow new Error('Target tag must be a valid string');\n\t}\n\n\tif (!Array.isArray(allTasks)) {\n\t\tthrow new Error('All tasks parameter must be an array');\n\t}\n\n\t// Enhanced task lookup to handle subtasks properly\n\tlet sourceTask = null;\n\n\t// Check if it's a subtask ID (e.g., \"1.2\")\n\tif (taskId.includes('.')) {\n\t\tconst [parentId, subtaskId] = taskId\n\t\t\t.split('.')\n\t\t\t.map((id) => parseInt(id, 10));\n\t\tconst parentTask = allTasks.find(\n\t\t\t(t) => t.id === parentId && t.tag === sourceTag\n\t\t);\n\n\t\tif (\n\t\t\tparentTask &&\n\t\t\tparentTask.subtasks &&\n\t\t\tArray.isArray(parentTask.subtasks)","sourceCodeStart":1740,"sourceCodeEnd":1776,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/dependency-manager.js#L1740-L1776","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the array of task objects for the relevant tag, e.g. data.tasks or data.tags[currentTag].","If you have tagged data, select the right tag's array before calling.","Ensure the preceding readTasks/getTasks call succeeded and returned an array.","Add Array.isArray(allTasks) checks at the call site to fail early with a clearer message."],"exampleFix":"// before\nmoveTaskBetweenTags('5.2', 'feature-x', taggedData);\n// after\nmoveTaskBetweenTags('5.2', 'feature-x', taggedData.tags['feature-x'] ?? taggedData.tasks);","handlingStrategy":"type-guard","validationCode":"function getTaskArrayForTag(taggedData, tag) {\n  const tasks = taggedData?.tags?.[tag] ?? taggedData?.tasks;\n  if (!Array.isArray(tasks)) throw new TypeError(`Expected an array of tasks for tag '${tag}'`);\n  return tasks;\n}","typeGuard":"const isTaskArray = (v) => Array.isArray(v) && v.every(t => t && typeof t === 'object' && 'id' in t);","tryCatchPattern":"if (!isTaskArray(allTasks)) {\n  throw new TypeError('moveTaskBetweenTags expects an array of task objects (the tag\\'s task list), not tagged data or null');\n}","preventionTips":["Pass data.tasks or data.tags[tag] — never the whole tagged data object.","Check Array.isArray on results of getTasks/readTasks before forwarding.","After refactors, verify the expected parameter shape against the function signature."],"tags":["validation","type-error","dependency-manager","api-misuse"],"backgroundTag":"parameter-must-be-array","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}