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

Matched route does not have an associated handler

Error message

Matched route does not have an associated handler

What it means

Thrown by Micro::handle when the router matched a route but no handler is registered under that route's id in the internal handlers map — the route was defined to the router without a matching Micro handler. Register the handler for the route.

Solutions

  1. Register a handler for the route with $app->map()/get()/post() etc.
  2. Ensure custom Router routes added directly to the router also get Micro handlers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Micro.zep:394 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/c6af90d0d6507570. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Micro.zep:394

            /**
             * Handling routing information
             */
            let router = <RouterInterface> container->getShared("router");

            /**
             * Handle the URI as normal
             */
            router->handle(uri);

            /**
             * Check if one route was matched
             */
            let matchedRoute = router->getMatchedRoute();

            if matchedRoute !== null {
                if unlikely !fetch handler, this->handlers[matchedRoute->getRouteId()] {
                    throw new NoMatchedRouteHandler();
                }

                /**
                 * Updating active handler
                 */
                let this->activeHandler = handler;

                /**
                 * Calling beforeExecuteRoute event
                 */
                if this->eventsManager !== null {
                    if this->eventsManager->fire("micro:beforeExecuteRoute", this) === false {
                        return false;
                    }

                    let handler = this->activeHandler;
                }

View on GitHub (pinned to b7419de9cd)