This happened by keeping on switching between two collab demos doing typing/deleting/undo/redo/cursor movements, I can reproduce this reasonably easy but unfortunately I could not find a sequence of steps to follow.
the debugger stops in: bundle_collab.js line 9288 function StepResult.fromReplace
Uncaught RangeError: Position 140 out of range
at Function.ResolvedPos.resolve (bundle_collab.js:5641)
at Function.ResolvedPos.resolveCached (bundle_collab.js:5664)
at Node.resolve (bundle_collab.js:5040)
at Node.replace (bundle_collab.js:4995)
at Function.fromReplace (bundle_collab.js:9285)
at ReplaceStep.apply (bundle_collab.js:9042)
at Transaction.maybeStep (bundle_collab.js:9631)
at bundle_collab.js:1881
at Leaf.forEachInvertedInner (bundle_collab.js:13774)
at Append.forEachInvertedInner (bundle_collab.js:13837)
ResolvedPos.resolve @ bundle_collab.js:5641
ResolvedPos.resolveCached @ bundle_collab.js:5664
Node.resolve @ bundle_collab.js:5040
Node.replace @ bundle_collab.js:4995
fromReplace @ bundle_collab.js:9285
apply @ bundle_collab.js:9042
maybeStep @ bundle_collab.js:9631
(anonymous) @ bundle_collab.js:1881
forEachInvertedInner @ bundle_collab.js:13774
forEachInvertedInner @ bundle_collab.js:13837
forEach @ bundle_collab.js:13715
popEvent @ bundle_collab.js:1866
histTransaction @ bundle_collab.js:2123
undo @ bundle_collab.js:2200
handleKeyDown @ bundle_collab.js:2544
(anonymous) @ bundle_collab.js:11862
EditorView.someProp @ bundle_collab.js:11515
editHandlers.keydown @ bundle_collab.js:11862
(anonymous) @ bundle_collab.js:11808
JSON.stringify({doc, from, to, slice}) gives:
"{"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"kjhjkhkjhjkhkjjhwedsfdgdsxvd ds f dssasadsfsqqqqdsfsdfsdf jkhjkhjkhjkhjhjkhjkhjkhkjwwwhg hj ghg hj gjhg hjhjg hjg hjgwwweesssdsgdssdfsjkh"}]}]},"from":140,"to":141,"slice":null}"