              raise KeyError(
                  "Migration %s dependencies reference nonexistent child node %r" % (migration, child)
              )
          if parent not in self.nodes:
              raise KeyError(
                  "Migration %s dependencies reference nonexistent parent node %r" % (migration, parent)
              )
          self.dependencies.setdefault(child, set()).add(parent)
          self.dependents.setdefault(parent, set()).add(child)
  
      def forwards_plan(self, node):
 
</s> remove             raise KeyError(
                "Migration %s dependencies reference nonexistent child node %r" % (migration, child)
 </s> add             raise NodeNotFoundError(
                "Migration %s dependencies reference nonexistent child node %r" % (migration, child),
                child </s> remove         with self.assertRaisesMessage(KeyError, msg):
 </s> add         with self.assertRaisesMessage(NodeNotFoundError, msg): </s> remove         with self.assertRaisesMessage(KeyError, msg):
 </s> add         with self.assertRaisesMessage(NodeNotFoundError, msg): </s> remove             raise ValueError("Node %r not a valid node" % (node, ))
 </s> add             raise NodeNotFoundError("Node %r not a valid node" % (node, ), node) </s> remove             raise ValueError("Node %r not a valid node" % (node, ))
 </s> add             raise NodeNotFoundError("Node %r not a valid node" % (node, ), node)
            raise NodeNotFoundError(
                "Migration %s dependencies reference nonexistent parent node %r" % (migration, parent),
                parent
              raise KeyError(
                  "Migration %s dependencies reference nonexistent child node %r" % (migration, child)
              )
          if parent not in self.nodes:
            raise NodeNotFoundError(
                "Migration %s dependencies reference nonexistent parent node %r" % (migration, parent),
                parent
            raise NodeNotFoundError(
                "Migration %s dependencies reference nonexistent parent node %r" % (migration, parent),
                parent
              )
          self.dependencies.setdefault(child, set()).add(parent)
          self.dependents.setdefault(parent, set()).add(child)
  
      def forwards_plan(self, node):
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #23556 -- Raised a more meaningful error message when migrations refer to an unavailable node 
django/db/migrations/graph.py