octobercms/october · error · ApplicationException

The model class :model must define a method :method() return

Error message

The model class :model must define a method :method() returning html color HEX codes for the ':field' form field.

What it means

Error "The model class :model must define a method :method() returning html color HEX codes for the ':field' form field." thrown in octobercms/october.

Source

Thrown at modules/backend/formwidgets/ColorPicker.php:134

        $this->vars['showInput'] = $this->showInput;
        $this->vars['readOnly'] = $this->readOnly;
        $this->vars['disabled'] = $this->disabled;
        $this->vars['isCustomColor'] = !in_array($value, $availableColors);
    }

    /**
     * getAvailableColors as a list of available colors.
     */
    protected function getAvailableColors(): array
    {
        $availableColors = $this->availableColors;
        if (is_array($availableColors)) {
            return $availableColors;
        }

        if (is_string($availableColors) && strlen($availableColors)) {
            if (!$this->model->methodExists($availableColors)) {
                throw new ApplicationException(Lang::get('backend::lang.field.colors_method_not_exists', [
                    'model' => get_class($this->model),
                    'method' => $availableColors,
                    'field' => $this->formField->fieldName
                ]));
            }

            // @deprecated just pass form field here -sg
            return (array) $this->model->{$availableColors}(
                $this->formField->fieldName,
                $this->formField->value,
                $this->formField->config
            );
        }

        return [];
    }

    /**

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/formwidgets/ColorPicker.php:134 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/382c07e265b7f34c. Report an issue: GitHub.