ir: Improve Invalid node error message in copyNode.