Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

fix(contextGatherer): cannot read properties of undefined reading forEach (#789)

Ralph Khreish8cde6c27087f
diff --git a/.changeset/rotten-months-brake.md b/.changeset/rotten-months-brake.md
new file mode 100644
index 00000000..6d72979b
--- /dev/null
+++ b/.changeset/rotten-months-brake.md
@@ -0,0 +1,5 @@
+---
+"task-master-ai": patch
+---
+
+Fix contextGatherer bug when adding a task `Cannot read properties of undefined (reading 'forEach')`
diff --git a/scripts/modules/utils/contextGatherer.js b/scripts/modules/utils/contextGatherer.js
index 29721858..1a826dec 100644
--- a/scripts/modules/utils/contextGatherer.js
+++ b/scripts/modules/utils/contextGatherer.js
@@ -123,7 +123,7 @@ export class ContextGatherer {
// Dependency Graph Analysis
if (dependencyTasks.length > 0) {
- const dependencyResults = this._buildDependencyContext(dependencyTasks);
+ const dependencyResults = this._buildDependencyGraphs(dependencyTasks);
dependencyResults.allRelatedTaskIds.forEach((id) =>
finalTaskIds.add(String(id))
);