diff --git a/Parallel/DIY/vtkDIYGhostUtilities.cxx b/Parallel/DIY/vtkDIYGhostUtilities.cxx
index c819b4f02cfdcb72b82677899c16a319557ec292..3417a6a05091db9bcb72b8d4cf0ffd9b615aec28 100644
--- a/Parallel/DIY/vtkDIYGhostUtilities.cxx
+++ b/Parallel/DIY/vtkDIYGhostUtilities.cxx
@@ -2362,13 +2362,6 @@ struct MatchingPointExtractor
   template<class PointArrayT>
   void operator()(PointArrayT* points, vtkIdTypeArray* globalPointIds)
   {
-    if ((globalPointIds == nullptr) != this->SourceGlobalPointIds.empty())
-    {
-      vtkLog(ERROR, "Inconsistency in the presence of global point ids across partitions. "
-          "The pipeline will fail at generating ghost cells");
-      return;
-    }
-
     std::vector<vtkIdType> inverseMap;
     auto sourcePointIdsRange = vtk::DataArrayValueRange<1>(this->SourcePointIds);
 
@@ -2616,7 +2609,7 @@ struct FillUnstructuredDataTopologyBufferFunctor<InputArrayT, OutputArrayT, vtkU
               // a copy of this point.
               faces->InsertCellPoint(-seedPointIdsToSendWithIndex.at(pointId));
             }
-          }          
+          }
         }
       }
       else if (faceLocations){
@@ -3084,6 +3077,13 @@ template<class PointSetT>
       vtkDataArray* interfacingPointsArray = blockStructure.InterfacingPoints->GetData();
       vtkIdTypeArray* interfacingGlobalPointIds = blockStructure.InterfacingGlobalPointIds;
 
+      if ((interfacingGlobalPointIds == nullptr) != matchingPointExtractor.SourceGlobalPointIds.empty())
+      {
+        vtkLog(ERROR, "Inconsistency in the presence of global point ids across partitions. "
+            "The pipeline will fail at generating ghost cells");
+        return LinkMap();
+      }
+
       if (!Dispatcher::Execute(interfacingPointsArray, matchingPointExtractor,
             interfacingGlobalPointIds))
       {
diff --git a/Parallel/DIY/vtkDIYGhostUtilities.txx b/Parallel/DIY/vtkDIYGhostUtilities.txx
index 599b28c611a4d65cd932498fc9e8a1ff2520e619..21f4b872b52bbff66ad93cb1321836f79d196f4a 100644
--- a/Parallel/DIY/vtkDIYGhostUtilities.txx
+++ b/Parallel/DIY/vtkDIYGhostUtilities.txx
@@ -689,6 +689,12 @@ int vtkDIYGhostUtilities::GenerateGhostCells(std::vector<DataSetT*>& inputs,
   vtkLogStartScope(TRACE, "Creating link map between connected blocks");
   LinkMap linkMap = vtkDIYGhostUtilities::ComputeLinkMap(master, inputs, outputGhostLevels);
   vtkLogEndScope("Creating link map between connected blocks");
+  // this is empty if there was an error in the usage of given global IDs.
+  // The error message will be printed internally
+  if (linkMap.empty())
+  {
+    return 0;
+  }
 
   vtkLogStartScope(TRACE, "Relinking blocks using link map");
   vtkDIYUtilities::Link(master, assigner, linkMap);