eyaltoledano/claude-task-master · error · Error
No valid tasks found in ${tasksPath}
Error message
No valid tasks found in ${tasksPath} What it means
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.
Source
Thrown at scripts/modules/task-manager/set-task-status.js:80
rawData = rawData._rawTaggedData;
}
// Ensure the tag exists in the raw data
if (!rawData || !rawData[tag] || !Array.isArray(rawData[tag].tasks)) {
throw new Error(
`Invalid tasks file or tag "${tag}" not found at ${tasksPath}`
);
}
// Get the tasks for the current tag
const data = {
tasks: rawData[tag].tasks,
tag,
_rawTaggedData: rawData
};
if (!data || !data.tasks) {
throw new Error(`No valid tasks found in ${tasksPath}`);
}
// Handle multiple task IDs (comma-separated)
const taskIds = taskIdInput.split(',').map((id) => id.trim());
const updatedTasks = [];
// Update each task and capture old status for display
for (const id of taskIds) {
// Capture old status before updating
let oldStatus = 'unknown';
if (id.includes('.')) {
// Handle subtask
const [parentId, subtaskId] = id
.split('.')
.map((id) => parseInt(id, 10));
const parentTask = data.tasks.find((t) => t.id === parentId);
if (parentTask?.subtasks) {View on GitHub (pinned to c0c98d367c)
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
Example fix
// before (tasks.json)
"mytag": {}
// after
"mytag": { "tasks": [] } Defensive patterns
Strategy: type-guard
Validate before calling
const raw = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
if (!Array.isArray(raw?.[tag]?.tasks)) {
throw new Error(`Tag '${tag}' is malformed: missing tasks array`);
} Type guard
function hasValidTasks(data) {
return Boolean(data) && Array.isArray(data.tasks);
} Try / catch
try {
await setTaskStatus(tasksPath, id, status, { tag });
} catch (err) {
if (err.message.startsWith('No valid tasks found')) {
console.error(`Tag '${tag}' entry is malformed — restore tasks.json from git or re-create the tag.`);
} else throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No valid tasks found in ${tasksPath}.
- Task description is required
- Task status is required
- Parent task ${parentId} not found
- Subtask ${subtaskId} not found in parent task ${parentId}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/e55ede0a8fc48c73.
Report an issue: GitHub.