Workaround for errors when showing AnnotationRuler Label text in 2D slice view

I’m hoping there is a workaround to solve an issue I’m getting with showing the label text of an AnnotationRuler label in the 2D slice views. I’m still needing to use this AnnotationRuler object instead of transitioning to a line node at the moment.

First place a ruler down on a volume and turn on the visibility for the 2D slice views.

ruler_node = slicer.mrmlScene.GetNodeByID("vtkMRMLAnnotationRulerNode1")
ruler_node.GetAnnotationTextDisplayNode().SetVisibility2D(True)

This will then produces lots of these errors if the slice intersection offset crosses the display such as the yellow slice intersection shown below. Turning off slice intersections has no change on these errors.

Tuple 1 out of range for provided array. Requested tuple: 0 Tuples: 0 from this place in the code
and Point array ctrlPtsSelected with 1 components, only has 0 tuples but there are 1 points from this place in the code.
image

Usually if you can get a stack trace you can see what conditiions lead to those messages and find a way to handle them. I know the Annotation code is kind of complex and slated for replacement, but if the only issue is avoiding the error message it should be manageable.