{"record":{"id":"e55ede0a8fc48c73","repo":"eyaltoledano/claude-task-master","slug":"no-valid-tasks-found-in-taskspath-e55ede","errorCode":null,"errorMessage":"No valid tasks found in ${tasksPath}","messagePattern":"No valid tasks found in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/set-task-status.js","lineNumber":80,"sourceCode":"\t\t\trawData = rawData._rawTaggedData;\n\t\t}\n\n\t\t// Ensure the tag exists in the raw data\n\t\tif (!rawData || !rawData[tag] || !Array.isArray(rawData[tag].tasks)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid tasks file or tag \"${tag}\" not found at ${tasksPath}`\n\t\t\t);\n\t\t}\n\n\t\t// Get the tasks for the current tag\n\t\tconst data = {\n\t\t\ttasks: rawData[tag].tasks,\n\t\t\ttag,\n\t\t\t_rawTaggedData: rawData\n\t\t};\n\n\t\tif (!data || !data.tasks) {\n\t\t\tthrow new Error(`No valid tasks found in ${tasksPath}`);\n\t\t}\n\n\t\t// Handle multiple task IDs (comma-separated)\n\t\tconst taskIds = taskIdInput.split(',').map((id) => id.trim());\n\t\tconst updatedTasks = [];\n\n\t\t// Update each task and capture old status for display\n\t\tfor (const id of taskIds) {\n\t\t\t// Capture old status before updating\n\t\t\tlet oldStatus = 'unknown';\n\n\t\t\tif (id.includes('.')) {\n\t\t\t\t// Handle subtask\n\t\t\t\tconst [parentId, subtaskId] = id\n\t\t\t\t\t.split('.')\n\t\t\t\t\t.map((id) => parseInt(id, 10));\n\t\t\t\tconst parentTask = data.tasks.find((t) => t.id === parentId);\n\t\t\t\tif (parentTask?.subtasks) {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/set-task-status.js#L62-L98","documentation":"Even after the tag check passes, setTaskStatus double-checks that the constructed data object has a tasks array before parsing task IDs. If tasks is missing or undefined it throws this error. In practice this fires when the tag object exists but holds no tasks property.","triggerScenarios":"A tag entry exists in the raw data but is null, or lacks a tasks field (e.g. created by manual JSON editing or an older schema), or the previously checked rawData[tag].tasks was deleted between checks in concurrent runs.","commonSituations":"Partially written/corrupt tasks.json after a crash; migrations from older task-master formats without tasks arrays; tags created externally with an empty or malformed object.","solutions":["Inspect the tag object in .taskmaster/tasks/tasks.json and ensure it has a 'tasks': [] array","Re-create the tag with 'task-master add-tag' to generate a valid structure","Restore the tasks file from version control or a backup"],"exampleFix":"// before (tasks.json)\n\"mytag\": {}\n// after\n\"mytag\": { \"tasks\": [] }","handlingStrategy":"type-guard","validationCode":"const raw = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nif (!Array.isArray(raw?.[tag]?.tasks)) {\n  throw new Error(`Tag '${tag}' is malformed: missing tasks array`);\n}","typeGuard":"function hasValidTasks(data) {\n  return Boolean(data) && Array.isArray(data.tasks);\n}","tryCatchPattern":"try {\n  await setTaskStatus(tasksPath, id, status, { tag });\n} catch (err) {\n  if (err.message.startsWith('No valid tasks found')) {\n    console.error(`Tag '${tag}' entry is malformed — restore tasks.json from git or re-create the tag.`);\n  } else throw err;\n}","preventionTips":["Never construct tag entries by hand; use add-tag so the schema is correct","Validate tasks.json with a JSON schema check in CI","Restore from version control after crashes or bad merges","Back up .taskmaster/tasks/tasks.json before migrations or upgrades"],"tags":["file-validation","data-corruption","task-management"],"backgroundTag":"corrupt-tasks-file","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}