octobercms/october · error · SystemException

The static method ':method()' on :class does not return a…

Error message

The static method ':method()' on :class does not return a valid options array.

What it means

Thrown by FilterScope::getOptionsFromModelAsString when a filter scope's options setting references a static callable ('ClassName::method') that executes successfully but does not return an array. The guard checks the return type only — the method ran, its result (a non-array value such as null, a string, or an object) is what fails.

Solutions

  1. Make the referenced static method return a plain array (e.g. key => value pairs) for all code paths, including early returns
  2. If using a relation or model method instead, change the scope's options config to the method name without the class prefix
  3. Wrap non-array sources with ->all() / (array) casts before returning
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/classes/FilterScope.php:59 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/897d6d162c9afb42. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/classes/FilterScope.php:59

        return $scopeOptions;
    }

    /**
     * getOptionsFromModelAsString where options are an explicit method reference
     */
    protected function getOptionsFromModelAsString($model, string $methodName)
    {
        // Calling via ClassName::method
        if (
            strpos($methodName, '::') !== false &&
            ($staticMethod = explode('::', $methodName)) &&
            count($staticMethod) === 2 &&
            is_callable($staticMethod)
        ) {
            $scopeOptions = $staticMethod($model, $this);

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

            $scopeOptions = $model->$methodName($this);
        }

View on GitHub (pinned to b608633a7e)