Are you by chance using SlicerMorph? Or trying to use undo/redo functionality for Markups module objects which includes the Line object?
This seems reminiscent of the following post:
However the above resulted in a change to the SlicerMorphRC file which should be used in the latest Slicer 5.6.1 assuming you re-installed SlicerMorph using the Slicer extensions manager which pulls the latest from the internet.