{"record":{"id":"8ffa938c1d4a3ba1","repo":"octobercms/october","slug":"the-settings-page-is-missing-a-model-definition","errorCode":null,"errorMessage":"The settings page is missing a Model definition.","messagePattern":"The settings page is missing a Model definition\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/system/controllers/Settings.php","lineNumber":189,"sourceCode":"    protected function initWidgets($model)\n    {\n        $config = $model->getFieldConfig();\n        $config->model = $model;\n        $config->arrayName = class_basename($model);\n        $config->context = 'update';\n\n        $widget = $this->makeWidget(\\Backend\\Widgets\\Form::class, $config);\n        $widget->bindToController();\n        $this->formWidget = $widget;\n    }\n\n    /**\n     * createModel is an internal method to prepare the form model object\n     */\n    protected function createModel($item)\n    {\n        if (!isset($item->class) || !strlen($item->class)) {\n            throw new ApplicationException(__('The settings page is missing a Model definition.'));\n        }\n\n        $class = $item->class;\n        return $class::instance();\n    }\n\n    /**\n     * findSettingItem locates a setting item for a module or plugin\n     */\n    protected function findSettingItem($author, $plugin, $code)\n    {\n        $manager = SettingsManager::instance();\n\n        $moduleOwner = $author;\n        $moduleCode = $plugin;\n        $item = $manager->findSettingItem($moduleOwner, $moduleCode);\n\n        if (!$item) {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/controllers/Settings.php#L171-L207","documentation":"Settings controller createModel() instantiates the model for a settings item. Every item registered via a plugin's registerSettings() must declare a 'class' pointing at a settings model (typically one extending System\\Models\\SettingModel). When the item has no class key or it is an empty string, 'The settings page is missing a Model definition.' is thrown before the form is built.","triggerScenarios":"A registerSettings() entry with no 'class' key; class set to '' ; settings item arrays constructed dynamically where the class element was omitted.","commonSituations":"Copy-pasted settings registration missing the class line; the model class was renamed and the key left blank; settings items meant as pure menu links mistakenly routed to the settings form.","solutions":["Add 'class' => 'Author\\Plugin\\Models\\Settings' to the registerSettings() entry","Confirm the class exists, is autoloadable, and extends System\\Models\\SettingModel (or otherwise provides a singleton instance())","Reload the backend settings page after fixing the plugin file"],"exampleFix":"// before\n'settings' => [\n    'label' => 'Shop Settings',\n    'icon' => 'icon-cog',\n    // no 'class' key\n],\n\n// after\n'settings' => [\n    'label' => 'Shop Settings',\n    'icon' => 'icon-cog',\n    'class' => 'Acme\\Shop\\Models\\Settings',\n],","handlingStrategy":"validation","validationCode":"$item = \\System\\Classes\\SettingsManager::instance()->listItems()[...] ?? null;\nif (!$item || empty($item->class)) {\n    // do not link to this settings page; it cannot build a model\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include 'class' in registerSettings() entries and cover it in plugin tests","Add a boot-time assertion that every registered settings item resolves to an existing class","When renaming settings models, update registerSettings() in the same commit"],"tags":["settings","plugin","configuration","model"],"backgroundTag":"missing-config-key","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}