diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 877d7678f7ae1f5a31c23f35ba095024b6d0f447..432067488b77285f4d019b287153930694d513d3 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -2438,7 +2438,10 @@ IndexBuildHeapScan(Relation heapRelation,
 			rootTuple = *heapTuple;
 			offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
 
-			Assert(OffsetNumberIsValid(root_offsets[offnum - 1]));
+			if (!OffsetNumberIsValid(root_offsets[offnum - 1]))
+				elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
+					 ItemPointerGetBlockNumber(&heapTuple->t_self),
+					 offnum, RelationGetRelationName(heapRelation));
 
 			ItemPointerSetOffsetNumber(&rootTuple.t_self,
 									   root_offsets[offnum - 1]);
@@ -2856,7 +2859,11 @@ validate_index_heapscan(Relation heapRelation,
 		if (HeapTupleIsHeapOnly(heapTuple))
 		{
 			root_offnum = root_offsets[root_offnum - 1];
-			Assert(OffsetNumberIsValid(root_offnum));
+			if (!OffsetNumberIsValid(root_offnum))
+				elog(ERROR, "failed to find parent tuple for heap-only tuple at (%u,%u) in table \"%s\"",
+					 ItemPointerGetBlockNumber(heapcursor),
+					 ItemPointerGetOffsetNumber(heapcursor),
+					 RelationGetRelationName(heapRelation));
 			ItemPointerSetOffsetNumber(&rootTuple, root_offnum);
 		}