{"record":{"id":"70b4203738fc6e99","repo":"octobercms/october","slug":"form-behavior-used-in-class-does-not-have-a-model","errorCode":null,"errorMessage":"Form behavior used in :class does not have a model defined.","messagePattern":"Form behavior used in :class does not have a model defined\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/widgets/Form.php","lineNumber":379,"sourceCode":"    /**\n     * initFormTabs\n     */\n    protected function initFormTabs()\n    {\n        $this->allTabs = (object) $this->allTabs;\n        $this->allTabs->outside = new FormTabs(['section' => FormTabs::SECTION_OUTSIDE]);\n        $this->allTabs->primary = new FormTabs(['section' => FormTabs::SECTION_PRIMARY]);\n        $this->allTabs->secondary = new FormTabs(['section' => FormTabs::SECTION_SECONDARY]);\n    }\n\n    /**\n     * validateModel validates the supplied form model.\n     * @return mixed\n     */\n    protected function validateModel()\n    {\n        if (!$this->model) {\n            throw new SystemException(Lang::get(\n                'backend::lang.form.missing_model',\n                ['class'=>get_class($this->controller)]\n            ));\n        }\n\n        $this->data = isset($this->data)\n            ? (object) $this->data\n            : $this->model;\n\n        // Non-existent models cannot use translatable features\n        if (!$this->model->exists) {\n            $this->useTranslatable = false;\n        }\n\n        return $this->model;\n    }\n\n    /**","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/widgets/Form.php#L361-L397","documentation":"validateModel guard in the Form widget: it checks that a model instance was bound to the form before initialization continues. An empty model property means the controller/form configuration never supplied one (missing model in the config, or a create/update action that failed to find a record), so the form cannot be built.","triggerScenarios":"Thrown at modules/backend/widgets/Form.php:379 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a model to the Form widget configuration, e.g. modelClass or an injected model instance","In controller form behaviors, ensure the record can be resolved (correct find record ID) so a model is bound before init"],"exampleFix":null,"handlingStrategy":"validation","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"}