{"record":{"id":"382c07e265b7f34c","repo":"octobercms/october","slug":"the-model-class-model-must-define-a-method-metho-382c07","errorCode":null,"errorMessage":"The model class :model must define a method :method() returning html color HEX codes for the ':field' form field.","messagePattern":"The model class :model must define a method :method\\(\\) returning html color HEX codes for the ':field' form field\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/formwidgets/ColorPicker.php","lineNumber":134,"sourceCode":"        $this->vars['showInput'] = $this->showInput;\n        $this->vars['readOnly'] = $this->readOnly;\n        $this->vars['disabled'] = $this->disabled;\n        $this->vars['isCustomColor'] = !in_array($value, $availableColors);\n    }\n\n    /**\n     * getAvailableColors as a list of available colors.\n     */\n    protected function getAvailableColors(): array\n    {\n        $availableColors = $this->availableColors;\n        if (is_array($availableColors)) {\n            return $availableColors;\n        }\n\n        if (is_string($availableColors) && strlen($availableColors)) {\n            if (!$this->model->methodExists($availableColors)) {\n                throw new ApplicationException(Lang::get('backend::lang.field.colors_method_not_exists', [\n                    'model' => get_class($this->model),\n                    'method' => $availableColors,\n                    'field' => $this->formField->fieldName\n                ]));\n            }\n\n            // @deprecated just pass form field here -sg\n            return (array) $this->model->{$availableColors}(\n                $this->formField->fieldName,\n                $this->formField->value,\n                $this->formField->config\n            );\n        }\n\n        return [];\n    }\n\n    /**","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/formwidgets/ColorPicker.php#L116-L152","documentation":"Error \"The model class :model must define a method :method() returning html color HEX codes for the ':field' form field.\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/formwidgets/ColorPicker.php:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}