octobercms/october · error · SystemException

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

Error message

The model class :model must define a method :method() returning options for the ':field' form field.

What it means

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

Source

Thrown at modules/backend/classes/FormField.php:545

     * getOptionsFromModelAsString where options are an explicit method reference
     */
    protected function getOptionsFromModelAsString($model, string $methodName, $data)
    {
        // Calling via ClassName::method
        if ($callableMethod = $this->getCallableMethodFromValue($methodName)) {
            $fieldOptions = $callableMethod($model, $this);

            if (!is_array($fieldOptions)) {
                throw new SystemException(Lang::get('backend::lang.field.options_static_method_invalid_value', [
                    'class' => $callableMethod[0],
                    'method' => $callableMethod[1]
                ]));
            }
        }
        // Calling via $model->method
        else {
            if (!$this->objectMethodExists($model, $methodName)) {
                throw new SystemException(Lang::get('backend::lang.field.options_method_not_exists', [
                    'model' => get_class($model),
                    'method' => $methodName,
                    'field' => $this->fieldName
                ]));
            }

            $fieldOptions = $model->$methodName($this->value, $this->fieldName, $data);
        }

        return $fieldOptions;
    }

    /**
     * getOptionsFromModelAsDefault refers to the model method or any of its behaviors
     */
    protected function getOptionsFromModelAsDefault($model, $data)
    {
        try {

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/classes/FormField.php:545 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/0de24ca857bf788c. Report an issue: GitHub.