octobercms/october · error · BadMethodCallException

cms::lang.component.method_not_found

Error message

cms::lang.component.method_not_found

What it means

Dynamic-method fallback in ComponentBase.__call: the called method does not exist on the component (or its extendable parents) and is not a method on the attached controller, so the magic __call throws BadMethodCallException with the component-scoped message.

Solutions

  1. Call an existing component method (check spelling/case)
  2. Add the method to the component class or via addDynamicMethod
  3. If proxying to the controller was intended, ensure the controller actually defines the method
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at modules/cms/classes/ComponentBase.php:367 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/14ae915bde1787a5. Report an issue: GitHub.

Appendix: source

Thrown at modules/cms/classes/ComponentBase.php:367

    /**
     * __call dynamically handles calls into the controller instance.
     * @param string $method
     * @param array $parameters
     * @return mixed
     */
    public function __call($method, $parameters)
    {
        try {
            return parent::__call($method, $parameters);
        }
        catch (BadMethodCallException $ex) {
        }

        if (method_exists($this->controller, $method)) {
            return call_user_func_array([$this->controller, $method], $parameters);
        }

        throw new BadMethodCallException(Lang::get('cms::lang.component.method_not_found', [
            'name' => get_class($this),
            'method' => $method
        ]));
    }

    /**
     * __toString returns the component's alias, used by __SELF__
     */
    public function __toString()
    {
        return $this->alias;
    }

    //
    // Internals
    //

    /**

View on GitHub (pinned to b608633a7e)