{"record":{"id":"111cd53ab41b91b3","repo":"eyaltoledano/claude-task-master","slug":"no-valid-tasks-found-in-taskspath","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/list-tasks.js","lineNumber":70,"sourceCode":"\t\t\t// Load tasks via tm-core tasks domain (supports both file and API storage)\n\t\t\tconst result = await tmCore.tasks.list({ tag });\n\t\t\tdata = { tasks: result.tasks };\n\n\t\t\tlog(\n\t\t\t\t'debug',\n\t\t\t\t`Loaded ${result.tasks.length} tasks via tm-core (${result.storageType} storage)`\n\t\t\t);\n\t\t} catch (storageError) {\n\t\t\tlog(\n\t\t\t\t'warn',\n\t\t\t\t`TmCore failed, falling back to legacy readJSON: ${storageError.message}`\n\t\t\t);\n\t\t\t// Fallback to old readJSON if tm-core fails\n\t\t\tdata = readJSON(tasksPath, projectRoot, tag);\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// Add complexity scores to tasks if report exists\n\t\t// `reportPath` is already tag-aware (resolved at the CLI boundary).\n\t\tconst complexityReport = readComplexityReport(reportPath);\n\t\t// Apply complexity scores to tasks\n\t\tif (complexityReport && complexityReport.complexityAnalysis) {\n\t\t\tdata.tasks.forEach((task) => addComplexityToTask(task, complexityReport));\n\t\t}\n\n\t\t// Filter tasks by status if specified - now supports comma-separated statuses\n\t\tlet filteredTasks;\n\t\tif (statusFilter && statusFilter.toLowerCase() !== 'all') {\n\t\t\t// Handle comma-separated statuses\n\t\t\tconst allowedStatuses = statusFilter\n\t\t\t\t.split(',')\n\t\t\t\t.map((s) => s.trim().toLowerCase())\n\t\t\t\t.filter((s) => s.length > 0); // Remove empty strings","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/list-tasks.js#L52-L88","documentation":"listTasks() attempts to load tasks (preferring tm-core, falling back to legacy readJSON) and requires a data object containing a tasks array. If both paths fail to yield tasks data, it throws, naming the resolved tasks file path.","triggerScenarios":"Both tm-core loadTasks and readJSON(tasksPath, projectRoot, tag) return null/undefined or an object without tasks — missing tasks file, invalid JSON, or wrong projectRoot/tag resolution before any listing occurs.","commonSituations":"Running `task-master list` in a project whose tasks.json was deleted or never created; JSON syntax error from hand-editing or a bad merge; pointing --file at a non-tasks JSON document; incorrect active tag with no corresponding file.","solutions":["Validate the tasks file at the path in the message is valid JSON with a tasks array; fix syntax errors.","If no tasks exist yet, create them via add-task or parse-prd before listing.","Run from the correct project root and confirm the active tag resolves to an existing tasks file."],"exampleFix":"// before\n$ task-master list  # .taskmaster/tasks/tasks.json missing\n// after\n$ task-master parse-prd prd.txt && task-master list","handlingStrategy":"type-guard","validationCode":"const fs = require('fs');\nif (!fs.existsSync(tasksPath)) throw new Error(`Tasks file missing: ${tasksPath}`);\nconst data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nif (!Array.isArray(data.tasks)) throw new Error(`${tasksPath} has no tasks array`);","typeGuard":"function isListableTasksData(v) {\n  return !!v && typeof v === 'object' && Array.isArray(v.tasks);\n}","tryCatchPattern":"try {\n  const tasks = await listTasks(options);\n} catch (err) {\n  if (err.message.startsWith('No valid tasks found in')) {\n    console.error(`Tasks file missing/invalid at ${tasksPath} — run parse-prd or add-task first.`);\n  } else throw err;\n}","preventionTips":["Create tasks (parse-prd / add-task) before listing in new projects.","Validate tasks.json after manual edits; a stray comma breaks parsing.","Confirm project root and active tag resolve to an existing tasks file."],"tags":["tasks-file","file-parsing","list-tasks"],"backgroundTag":"invalid-tasks-json","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}