phalcon/cphalcon · error · Phalcon\Mvc\Micro\Exceptions\NoHandlersToMount

There are no handlers to mount

Error message

There are no handlers to mount

What it means

Thrown by Micro::mount when the collection being mounted reports an empty handler list via getHandlers() (a companion guard also rejects an empty main handler). A CollectionInterface without handlers would register no routes, so the guard refuses to mount it; the input at fault is the Phalcon\Mvc\Micro\Collection passed in, which was built without any get()/post()/... route definitions.

Solutions

  1. Add handlers to the collection via collection->get/post/... before mounting
  2. Skip mounting empty collections entirely
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Micro.zep:790 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/e244ef794e6e9fc3. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Micro.zep:790

     */
    public function mount(<CollectionInterface> collection) -> <static>
    {
        var mainHandler, handlers, lazyHandler, prefix, methods, pattern,
            subHandler, realHandler, prefixedPattern, route, handler, name;

        /**
         * Get the main handler
         */
        let mainHandler = collection->getHandler();

        if unlikely empty mainHandler {
            throw new MissingCollectionMainHandler();
        }

        let handlers = collection->getHandlers();

        if unlikely empty handlers {
            throw new NoHandlersToMount();
        }

        /**
         * Check if handler is lazy
         */
        if collection->isLazy() {
            let lazyHandler = new LazyLoader(mainHandler);
        } else {
            let lazyHandler = mainHandler;
        }

        /**
         * Get the main prefix for the collection
         */
        let prefix = collection->getPrefix();

        for handler in handlers {
            if unlikely typeof handler !== "array" {

View on GitHub (pinned to b7419de9cd)