{"record":{"id":"f8cba0d0881aa5eb","repo":"eyaltoledano/claude-task-master","slug":"no-valid-tasks-found-in-taskspath-f8cba0","errorCode":null,"errorMessage":"No valid tasks found in ${tasksPath}","messagePattern":"No valid tasks found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/update-tasks.js","lineNumber":77,"sourceCode":"\n\ttry {\n\t\tif (isMCP) logFn.info(`Updating tasks from ID ${fromId}`);\n\t\telse\n\t\t\tlogFn(\n\t\t\t\t'info',\n\t\t\t\t`Updating tasks from ID ${fromId} with prompt: \"${prompt}\"`\n\t\t\t);\n\n\t\t// Determine project root\n\t\tconst projectRoot = providedProjectRoot || findProjectRoot();\n\t\tif (!projectRoot) {\n\t\t\tthrow new Error('Could not determine project root directory');\n\t\t}\n\n\t\t// --- Task Loading/Filtering (Updated to pass projectRoot and tag) ---\n\t\tconst data = readJSON(tasksPath, projectRoot, tag);\n\t\tif (!data || !data.tasks)\n\t\t\tthrow new Error(`No valid tasks found in ${tasksPath}`);\n\t\tconst tasksToUpdate = data.tasks.filter(\n\t\t\t(task) => task.id >= fromId && task.status !== 'done'\n\t\t);\n\t\tif (tasksToUpdate.length === 0) {\n\t\t\tif (isMCP)\n\t\t\t\tlogFn.info(`No tasks to update (ID >= ${fromId} and not 'done').`);\n\t\t\telse\n\t\t\t\tlogFn('info', `No tasks to update (ID >= ${fromId} and not 'done').`);\n\t\t\tif (outputFormat === 'text') console.log(/* yellow message */);\n\t\t\treturn; // Nothing to do\n\t\t}\n\t\t// --- End Task Loading/Filtering ---\n\n\t\t// --- Context Gathering ---\n\t\tlet gatheredContext = '';\n\t\ttry {\n\t\t\tconst contextGatherer = new ContextGatherer(projectRoot, tag);\n\t\t\tconst allTasksFlat = flattenTasksWithSubtasks(data.tasks);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/update-tasks.js#L59-L95","documentation":"updateTasks reads tasks.json via readJSON and requires both the parsed object and its tasks array. If tasks.json is missing, unreadable, corrupt, or lacks a tasks array, this error is thrown with the attempted path.","triggerScenarios":"tasks.json does not exist at <projectRoot>/.taskmaster/tasks.json, readJSON returns null (parse failure or missing file), or the JSON parses but has no tasks key.","commonSituations":"Fresh projects with no tasks yet, manually edited/corrupted tasks.json, running from a different tag context where the tag has no tasks, or wrong projectRoot passed programmatically.","solutions":["Confirm .taskmaster/tasks.json exists and contains {\"tasks\": [...]} at the resolved project root","Run 'task-master init' or 'task-master parse-prd' to create tasks.json if missing","Validate/repair tasks.json with a JSON linter if it was hand-edited","Check you are operating on the intended tag (current tag state.json) that actually has tasks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import fs from 'fs';\nconst tasksPath = `${projectRoot}/.taskmaster/tasks.json`;\nif (!fs.existsSync(tasksPath)) throw new Error('tasks.json missing; run task-master parse-prd');\nconst data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nif (!Array.isArray(data?.tasks)) throw new Error('tasks.json invalid');","typeGuard":"const isValidTasksData = (d) => !!d && typeof d === 'object' && Array.isArray(d.tasks);","tryCatchPattern":"try {\n  await updateTasks(...);\n} catch (e) {\n  if (e.message.startsWith('No valid tasks found in')) {\n    // regenerate tasks.json or fix JSON corruption\n  } else throw e;\n}","preventionTips":["Keep tasks.json under JSON validation in editors/CI","Back up before hand-editing tasks.json","Generate tasks via parse-prd instead of manual creation","Confirm the active tag has tasks before batch updates"],"tags":["file-io","json-parsing","tasks-data","missing-file"],"backgroundTag":"tasks-json-missing-or-corrupt","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}