{"record":{"id":"e917d0548710a29a","repo":"eyaltoledano/claude-task-master","slug":"invalid-tasks-data-in-taskspath","errorCode":null,"errorMessage":"Invalid tasks data in ${tasksPath}","messagePattern":"Invalid tasks data in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/expand-all-tasks.js","lineNumber":88,"sourceCode":"\t\t\t\t});\n\n\tlet loadingIndicator = null;\n\tlet expandedCount = 0;\n\tlet failedCount = 0;\n\tlet tasksToExpandCount = 0;\n\tconst allTelemetryData = []; // Still collect individual data first\n\n\tif (!isMCPCall && outputFormat === 'text') {\n\t\tloadingIndicator = startLoadingIndicator(\n\t\t\t'Analyzing tasks for expansion...'\n\t\t);\n\t}\n\n\ttry {\n\t\tlogger.info(`Reading tasks from ${tasksPath}`);\n\t\tconst data = readJSON(tasksPath, projectRoot, tag);\n\t\tif (!data || !data.tasks) {\n\t\t\tthrow new Error(`Invalid tasks data in ${tasksPath}`);\n\t\t}\n\n\t\t// --- Restore Original Filtering Logic ---\n\t\tconst tasksToExpand = data.tasks.filter(\n\t\t\t(task) =>\n\t\t\t\t(task.status === 'pending' || task.status === 'in-progress') && // Include 'in-progress'\n\t\t\t\t(!task.subtasks || task.subtasks.length === 0 || force) // Check subtasks/force here\n\t\t);\n\t\ttasksToExpandCount = tasksToExpand.length; // Get the count from the filtered array\n\t\tlogger.info(`Found ${tasksToExpandCount} tasks eligible for expansion.`);\n\t\t// --- End Restored Filtering Logic ---\n\n\t\tif (loadingIndicator) {\n\t\t\tstopLoadingIndicator(loadingIndicator, 'Analysis complete.');\n\t\t}\n\n\t\tif (tasksToExpandCount === 0) {\n\t\t\tlogger.info('No tasks eligible for expansion.');","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/expand-all-tasks.js#L70-L106","documentation":"expandAllTasks() reads the tasks file with readJSON() and requires the result to contain a tasks property. A null result (unreadable/invalid JSON) or an object without tasks means there is nothing to expand, so it throws with the file path in the message.","triggerScenarios":"readJSON(tasksPath, projectRoot, tag) returns null because the file does not exist or contains invalid JSON, or returns a JSON object lacking a tasks key (e.g. a complexity report or config file passed as tasksPath).","commonSituations":"Tasks file deleted or moved; syntax error introduced by manual editing; wrong tag resolution pointing to a nonexistent per-tag file; passing --file with the wrong document.","solutions":["Verify the tasks file exists at the reported path and is valid JSON with a top-level tasks array.","Run `task-master models --setup` no — instead re-generate the file via `task-master init` or `parse-prd` if it is missing.","Confirm the correct tag is active (task-master use-tag) so readJSON resolves the right file."],"exampleFix":"// before\n{ \"projectName\": \"app\" }            // no tasks key\n// after\n{ \"projectName\": \"app\", \"tasks\": [ { \"id\": 1, \"title\": \"...\", \"description\": \"...\", \"status\": \"pending\" } ] }","handlingStrategy":"type-guard","validationCode":"const fs = require('fs');\nconst raw = fs.readFileSync(tasksPath, 'utf8');\nconst data = JSON.parse(raw);\nif (!data || !Array.isArray(data.tasks)) throw new Error(`${tasksPath} must contain a tasks array`);","typeGuard":"function isTasksData(v) {\n  return !!v && typeof v === 'object' && Array.isArray(v.tasks);\n}","tryCatchPattern":"try {\n  await expandAllTasks(context);\n} catch (err) {\n  if (err.message.startsWith('Invalid tasks data in')) {\n    console.error(`Fix or regenerate the tasks file at ${tasksPath}.`);\n  } else throw err;\n}","preventionTips":["Validate tasks.json (JSON schema) after manual edits or merges.","Confirm the active tag's tasks file exists before expansion.","Never pass non-tasks JSON files as tasksPath."],"tags":["tasks-file","file-parsing","validation"],"backgroundTag":"invalid-tasks-json","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}