{"record":{"id":"789c276888166bc6","repo":"phalcon/cphalcon","slug":"exception-no-di","errorCode":"EXCEPTION_NO_DI","errorMessage":"A dependency injection container is required to access the 'response' service","messagePattern":"A dependency injection container is required to access the 'response' service","errorType":"exception","errorClass":"Phalcon\\Mvc\\Dispatcher\\Exceptions\\ResponseServiceUnavailable","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Dispatcher.zep","lineNumber":222,"sourceCode":"\n        if typeof eventsManager == \"object\" {\n            if eventsManager->fire(\"dispatch:beforeException\", this, exception) === false {\n                return false;\n            }\n        }\n    }\n\n    /**\n     * Throws an internal exception\n     */\n    protected function throwDispatchException( string message, int exceptionCode = 0)\n    {\n        var container, response, exception;\n\n        let container = this->container;\n\n        if container === null {\n            throw new ResponseServiceUnavailable();\n        }\n\n        let response = <ResponseInterface> container->getShared(\"response\");\n\n        /**\n         * Dispatcher exceptions automatically sends a 404 status\n         */\n        response->setStatusCode(404, \"Not Found\");\n\n        /**\n         * Create the real exception\n         */\n        let exception = new Exception(message, exceptionCode);\n\n        if this->handleException(exception) === false {\n            return false;\n        }\n","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Dispatcher.zep#L204-L240","documentation":"Error \"A dependency injection container is required to access the 'response' service\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Dispatcher.zep:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}