{"record":{"id":"ca61375ca760514f","repo":"octobercms/october","slug":"model-model-used-in-class-is-not-valid-it-must","errorCode":null,"errorMessage":"Model :model used in :class is not valid, it must inherit the \\Model class.","messagePattern":"Model :model used in :class is not valid, it must inherit the \\\\Model class\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/widgets/Lists.php","lineNumber":367,"sourceCode":"        $this->currentPageNumber = 1;\n\n        return $this->onRefresh();\n    }\n\n    /**\n     * validateModel is present and right class type\n     */\n    protected function validateModel()\n    {\n        if (!$this->model) {\n            throw new ApplicationException(Lang::get(\n                'backend::lang.list.missing_model',\n                ['class'=>get_class($this->controller)]\n            ));\n        }\n\n        if (!$this->model instanceof Model) {\n            throw new ApplicationException(Lang::get(\n                'backend::lang.model.invalid_class',\n                ['model'=>get_class($this->model), 'class'=>get_class($this->controller)]\n            ));\n        }\n\n        return $this->model;\n    }\n\n    /**\n     * parseTableName replaces the @ symbol with a table name in a model\n     * @param  string $sql\n     * @param  string $table\n     * @return string\n     */\n    protected function parseTableName($sql, $table)\n    {\n        return str_replace('@', $table.'.', $sql);\n    }","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/widgets/Lists.php#L349-L385","documentation":"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.","triggerScenarios":"Thrown at modules/backend/widgets/Lists.php:367 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}