          """
          graph = MigrationGraph()
          message = "Node ('app_b', '0001') not a valid node"
  
          with self.assertRaisesMessage(ValueError, message):
              graph.forwards_plan(("app_b", "0001"))
  
          with self.assertRaisesMessage(ValueError, message):
              graph.backwards_plan(("app_b", "0001"))
  
 
</s> remove         with self.assertRaisesMessage(ValueError, message):
 </s> add         with self.assertRaisesMessage(NodeNotFoundError, message): </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)
        with self.assertRaisesMessage(NodeNotFoundError, message):
          """
          graph = MigrationGraph()
          message = "Node ('app_b', '0001') not a valid node"
  
        with self.assertRaisesMessage(NodeNotFoundError, message):
              graph.forwards_plan(("app_b", "0001"))
  
          with self.assertRaisesMessage(ValueError, message):
              graph.backwards_plan(("app_b", "0001"))
  
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 
tests/migrations/test_graph.py