octobercms/october · error · Error

Invalid index type

Error message

Invalid index type: {}

What it means

Invariant violation in the treeview drag-and-drop engine's completeDrop: dropData.to.indexType did not match any known case ('above', 'below', 'first'). The insertion-point descriptor coming from the drop planner is unrecognized, meaning corrupted drag state or a newly introduced index kind that completeDrop was not taught to handle.

Solutions

  1. Ensure the drop planner emits only 'above', 'below' or 'first' as indexType
  2. Add a matching case to the switch when introducing a new insertion mode
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/vuecomponents/treeview/assets/js/classes/draganddrop.js:587 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/acfd7e456883c867. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/vuecomponents/treeview/assets/js/classes/draganddrop.js:587

                parentNode = node;
                node.expand();
                break;
            default:
                throw new Error('Invalid parent type: ' + dropData.to.parentType);
        }

        switch (dropData.to.indexType) {
            case 'above':
                targetIndex = node.indexInParent;
                break;
            case 'below':
                targetIndex = node.indexInParent + 1;
                break;
            case 'first':
                targetIndex = 0;
                break;
            default:
                throw new Error('Invalid index type: ' + dropData.to.indexType);
        }

        dropData.droppedNodes.forEach(function(droppedNodeData) {
            var originalNode = droppedNodeData.nodeData;

            targetNodeList.splice(targetIndex, 0, originalNode);

            var indexToDelete = droppedNodeData.parentArray.indexOf(originalNode);
            droppedNodeData.parentArray.splice(indexToDelete, 1);
        });
    }

    mouseDown(ev) {
        // Stop the mousedown event for draggable nodes
        // if this is not a touch device. On touch devices,
        // we do not support drag and drop.

        var $closestNode = $(ev.target).closest('li');

View on GitHub (pinned to b608633a7e)