Tingchang:
yes, there is probably little you can do about this -- some code
encounters a situation it does not expect, and unless the code is fixed,
there is not much you can do. Like you, I suspect that it is a situation
that has to do with points where two cells meet at a vertex without
sharing a whole face. This is uncommon enough in real meshes that I'm
not surprised that there are bugs.
The code you attached has 470 lines of code and your example shows that
it runs for 130 cycles. Do you think you can come up with a "minimal
working example", or at least a much reduced but self-contained code
that shows the problem? It does not actually have to do anything useful,
just (i) be as short as possible to make it easy to understand what it
is doing, and (ii) trigger the error.
Best
W.