eyaltoledano/claude-task-master · error
Parsed AI response for updated tasks was not an array.
Error message
Parsed AI response for updated tasks was not an array.
What it means
The AI is asked to return an array of updated tasks. After parsing the response (which usually enforces array-ness), updateTasks re-checks Array.isArray(parsedUpdatedTasks) as a defense-in-depth guard and throws if it is not an array. It signals the AI output did not match the expected batch-update schema.
Source
Thrown at scripts/modules/task-manager/update-tasks.js:252
dependencies: task.dependencies ?? [],
priority: task.priority ?? null,
details: task.details ?? null,
testStrategy: task.testStrategy ?? null,
subtasks: task.subtasks
? task.subtasks.map((subtask) => ({
...subtask,
dependencies: subtask.dependencies ?? [],
status: subtask.status ?? 'pending',
testStrategy: subtask.testStrategy ?? null
}))
: null
})
);
// --- Update Tasks Data (Updated writeJSON call) ---
if (!Array.isArray(parsedUpdatedTasks)) {
// Should be caught by parser, but extra check
throw new Error(
'Parsed AI response for updated tasks was not an array.'
);
}
if (isMCP)
logFn.info(
`Received ${parsedUpdatedTasks.length} updated tasks from AI.`
);
else
logFn(
'info',
`Received ${parsedUpdatedTasks.length} updated tasks from AI.`
);
// Create a map for efficient lookup
const updatedTasksMap = new Map(
parsedUpdatedTasks.map((task) => [task.id, task])
);
let actualUpdateCount = 0;View on GitHub (pinned to c0c98d367c)
Solutions
- Retry the operation; AI output variance is often transient
- Use --research or a stronger model for the batch update
- Reduce the number of tasks updated in one call (lower fromId scope or update fewer tasks)
- Check provider connectivity/model config if malformed responses recur
Defensive patterns
Strategy: validation
Validate before calling
if (!Array.isArray(parsedUpdatedTasks)) {
// retry the AI call or fall back to per-task updates
} Type guard
const isUpdatedTasksArray = (v) => Array.isArray(v) && v.every((t) => t && typeof t === 'object' && typeof t.id !== 'undefined');
Try / catch
try {
await updateTasks(...);
} catch (e) {
if (e.message.includes('was not an array')) {
// retry with stronger model or smaller batch
} else throw e;
} Prevention
- Batch fewer tasks per update call
- Use research-tier models for multi-task operations
- Verify parsed JSON shape before writing
- Retry once on schema failures before surfacing to users
When it happens
Trigger: AI response parsed (e.g. from a JSON blob in text) into a non-array value — an object, null, or string — during the update-tasks batch operation.
Common situations: Model returning a single object instead of an array when only one task changes, malformed JSON wrapped in prose, or context overflow truncating the response.
Related errors
- Received invalid task object from AI.
- ${result.message} || Update failed for task ${taskId}. The s
- File storage does not support updateTaskWithPrompt. Client-s
- File storage does not support expandTaskWithPrompt. Client-s
- Failed to generate tasks using generateObject fallback
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/0036271d028c279f.
Report an issue: GitHub.