diff --git a/Task/Generate.php b/Task/Generate.php
index <HASH>..<HASH> 100644
--- a/Task/Generate.php
+++ b/Task/Generate.php
@@ -293,6 +293,8 @@ class Generate extends Base {
     foreach ($components as $name => $component) {
       $parent_name = $component->containingComponent();
       if (!empty($parent_name)) {
+        assert(isset($components[$parent_name]), "Containing component '$parent_name' given by '$name' is not a component ID.");
+
         $tree[$parent_name][] = $name;
       }
     }
Added assertion to check containing component is a valid ID.