                      self.graph.add_dependency(migration, key, parent)
              for child in migration.run_before:
                  child = self.check_key(child, key[0])
                  if child is not None:
                      self.graph.add_dependency(migration, child, key)
  
      def detect_conflicts(self):
          """
          Looks through the loaded graph and detects any conflicts - apps
          with more than one leaf migration. Returns a dict of the app labels
 
</s> remove                     self.graph.add_dependency(migration, key, parent)
 </s> add                     try:
                        self.graph.add_dependency(migration, key, parent)
                    except NodeNotFoundError as e:
                        # Since we added "key" to the nodes before this implies
                        # "parent" is not in there.
                        _reraise_missing_dependency(migration, parent, e) </s> remove                 self.graph.add_dependency(migration, key, parent)
 </s> add                 try:
                    self.graph.add_dependency(migration, key, parent)
                except NodeNotFoundError as e:
                    # Since we added "key" to the nodes before this implies
                    # "parent" is not in there. To make the raised exception
                    # more understandable we check if parent could have been
                    # replaced but hasn't (eg partially applied squashed
                    # migration)
                    _reraise_missing_dependency(migration, parent, e) </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             raise ValueError("Node %r not a valid node" % (node, ))
 </s> add             raise NodeNotFoundError("Node %r not a valid node" % (node, ), node)
                    try:
                        self.graph.add_dependency(migration, child, key)
                    except NodeNotFoundError as e:
                        # Since we added "key" to the nodes before this implies
                        # "child" is not in there.
                        _reraise_missing_dependency(migration, child, e)
                      self.graph.add_dependency(migration, key, parent)
              for child in migration.run_before:
                  child = self.check_key(child, key[0])
                  if child is not None:
                    try:
                        self.graph.add_dependency(migration, child, key)
                    except NodeNotFoundError as e:
                        # Since we added "key" to the nodes before this implies
                        # "child" is not in there.
                        _reraise_missing_dependency(migration, child, e)
  
      def detect_conflicts(self):
          """
          Looks through the loaded graph and detects any conflicts - apps
          with more than one leaf migration. Returns a dict of the app labels
keep keep keep keep replace keep keep keep keep keep
 Fixed #23556 -- Raised a more meaningful error message when migrations refer to an unavailable node 
django/db/migrations/loader.py