Error when completing brackets

I get this error when completing brackets

TypeError: Cannot read properties of undefined (reading 'breakAfter')
    at DocView.coordsAt (index.js?02d1:2231)
    at EditorView.coordsAtPos (index.js?02d1:6161)
    at eval (index.js?6613:81)
    at (<anonymous>)
    at _codemirror_view__WEBPACK_IMPORTED_MODULE_0__.ViewPlugin.fromClass.eventHandlers.scroll.readMeasure (index.js?6613:81)
    at eval (index.js?02d1:5873)
    at (<anonymous>)
    at EditorView.measure (index.js?02d1:5871)
    at eval (index.js?02d1:5982)

This is the coordsAt function.

coordsAt(pos, side) {
        for (let off = this.length, i = this.children.length - 1;; i--) {
            let child = this.children[i], start = off - child.breakAfter - child.length;
            if (pos > start ||
                (pos == start && child.type != BlockType.WidgetBefore && child.type != BlockType.WidgetAfter &&
                    (!i || side == 2 || this.children[i - 1].breakAfter ||
                        (this.children[i - 1].type == BlockType.WidgetBefore && side > -2))))
                return child.coordsAt(pos - start, side);
            off = start;

It looks like accessing the breakAfter property of variable child throws an error.

Is there a way to fix this? looks like something internal to cm6?


Some more context. This only happens when the bracket completing is the first line of the cm instance. If it has multiple lines, this error does not occur.

Does ‘completing brackets’ mean the auto-closing done by closeBrackets? Can you provide more detailed instructions on how to reproduce this?

Yes the auto closing feature. Unfortunately, not able to reproduce it. Will post more when I have some deeper breakthrough available - one that you can do something about. Thanks!