octobercms/october · error · ApplicationException
Model :model used in :class is not valid, it must inherit…
Error message
Model :model used in :class is not valid, it must inherit the \Model class.
What it means
Second guard in validateModel: the bound model exists but is not an instance of the framework Model class. Any object other than an Eloquent-style model lacks the query and relation machinery the list relies on, so it is rejected; :model and :class carry the invalid class and controller names.
Solutions
- Bind a model that inherits from the framework's base Model class
- Check for typos in the configured modelClass that may resolve to a non-model class
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at modules/backend/widgets/Lists.php:367 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/ca61375ca760514f.
Report an issue: GitHub.
Appendix: source
Thrown at modules/backend/widgets/Lists.php:367
$this->currentPageNumber = 1;
return $this->onRefresh();
}
/**
* validateModel is present and right class type
*/
protected function validateModel()
{
if (!$this->model) {
throw new ApplicationException(Lang::get(
'backend::lang.list.missing_model',
['class'=>get_class($this->controller)]
));
}
if (!$this->model instanceof Model) {
throw new ApplicationException(Lang::get(
'backend::lang.model.invalid_class',
['model'=>get_class($this->model), 'class'=>get_class($this->controller)]
));
}
return $this->model;
}
/**
* parseTableName replaces the @ symbol with a table name in a model
* @param string $sql
* @param string $table
* @return string
*/
protected function parseTableName($sql, $table)
{
return str_replace('@', $table.'.', $sql);
}View on GitHub (pinned to b608633a7e)