octobercms/october · error · ApplicationException
The relationship morphTo is not supported for list columns.
Error message
The relationship morphTo is not supported for list columns.
What it means
Constraint in prepareQuery: while wiring custom select clauses for relation columns, only belongTo/hasMany-style relations can be joined. A polymorphic morphTo relation cannot be resolved to a single related table at query time, so declaring one as a list column with a relation is unsupported and throws.
Solutions
- Remove the relation-based column for morphTo relations and render the value via a partial or a custom accessor instead
- Define a dedicated relation (belongsTo) for the specific type if only one target is used in practice
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at modules/backend/widgets/Lists.php:516 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/2bcaf9af2dc96aa8.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/widgets/Lists.php:516
}
// Allow extensions inside the search grouping
$this->fireSystemEvent('backend.list.extendSearchQuery', [$innerQuery]);
});
// Custom select queries
foreach ($this->getVisibleColumns() as $column) {
if (!$column->sqlSelect) {
continue;
}
$alias = $query->getQuery()->getGrammar()->wrap($column->columnName);
// Relation column
if ($column->relation) {
$relationType = $this->model->getRelationType($column->relation);
if ($relationType === 'morphTo') {
throw new ApplicationException('The relationship morphTo is not supported for list columns.');
}
$table = $this->model->makeRelation($column->relation)->getTable();
$sqlSelect = $this->parseTableName($column->sqlSelect, $table);
// Manipulate a count query for the sub query
$relationObj = $this->model->{$column->relation}();
$relationQuery = $relationObj->getRelated()->newQuery();
// Apply related constraints to the sub query
// Possibility: the column could contribute to this via conditions or scope
$relationObj->addDefinedConstraintsToQuery($relationQuery);
$countQuery = $relationObj->getRelationExistenceQuery($relationQuery, $query);
$isMultiRelation = $this->isColumnRelated($column, true);
$joinSql = $isMultiRelationView on GitHub (pinned to b608633a7e)