octobercms/october · error · Error

Cannot find TH element for the Inspector row

Error message

Cannot find TH element for the Inspector row

What it means

Fires in Surface.prototype.applyGroupLevelToRow when getRowHeadElement(row) returns null for a row created for an Inspector group, so the group level cannot be written to the row head. It indicates the generated table row markup is missing its <th> head cell, usually due to markup/structure drift between the surface renderer and this helper.

Solutions

  1. Inspect the generated Inspector table markup and ensure each group row contains the expected <th> head element matched by getRowHeadElement
  2. Check for custom CSS/JS or third-party overrides that strip or rename the row head cell
  3. Update or patch getRowHeadElement's selector if the table structure was intentionally changed
  4. Log the row's outerHTML to diagnose which group produces the broken row
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at modules/backend/assets/foundation/controls/inspector/inspector.surface.js:405 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/24f9108771410e95. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/assets/foundation/controls/inspector/inspector.surface.js:405

            row.setAttribute('data-group-index', this.getGroupManager().getGroupIndex(group))
            row.setAttribute('data-parent-group-index', this.getGroupManager().getGroupIndex(group.parentGroup))
        }
        else {
            if (group.parentGroup) {
                row.setAttribute('data-parent-group-index', this.getGroupManager().getGroupIndex(group))
            }
        }
    }

    Surface.prototype.applyGroupLevelToRow = function(row, group) {
        if (row.hasAttribute('data-group-level')) {
            return;
        }

        var th = this.getRowHeadElement(row);

        if (th === null) {
            throw new Error('Cannot find TH element for the Inspector row');
        }

        var groupLevel = group.getLevel();

        row.setAttribute('data-group-level', groupLevel)
        th.children[0].style.marginLeft = groupLevel*10 + 'px'
    }

    Surface.prototype.toggleGroup = function(row, forceExpand) {
        var link = row.querySelector('a'),
            groupIndex = row.getAttribute('data-group-index'),
            table = this.getRootTable(),
            groupManager = this.getGroupManager(),
            collapse = true

        if ($.oc.foundation.element.hasClass(link, 'expanded') && !forceExpand) {
            $.oc.foundation.element.removeClass(link, 'expanded')
        }

View on GitHub (pinned to b608633a7e)