{"record":{"id":"415d097dd405055c","repo":"phalcon/cphalcon","slug":"response-handler-is-not-callable-or-is-not-defined","errorCode":null,"errorMessage":"Response handler is not callable or is not defined","messagePattern":"Response handler is not callable or is not defined","errorType":"exception","errorClass":"Phalcon\\Mvc\\Micro\\Exceptions\\ResponseHandlerNotCallable","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Micro.zep","lineNumber":711,"sourceCode":"                } else {\n                    if returnedValue !== false {\n                        throw e;\n                    }\n                }\n            } else {\n                if returnedValue !== false {\n                    throw e;\n                }\n            }\n        }\n\n        /**\n         * Check if a response handler is defined, else use default response\n         * handler\n         */\n        if this->responseHandler {\n            if unlikely !is_callable(this->responseHandler) {\n                throw new ResponseHandlerNotCallable();\n            }\n\n            let returnedValue = call_user_func(this->responseHandler);\n        } else {\n            /**\n             * Check if the returned value is a string and take it as response\n             * body\n             */\n            if typeof returnedValue === \"string\" {\n                let response = <ResponseInterface> container->getShared(\"response\");\n\n                if !response->isSent() {\n                    response->setContent(returnedValue);\n                    response->send();\n                }\n            }\n\n            /**","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Micro.zep#L693-L729","documentation":"Thrown in the finishing phase of Micro::handle when a response handler is registered ($this->responseHandler via Micro::responseHandler) but its value is not callable. After the route handler (or error path) produced a return value, Micro wants to pass it through the custom response handler; the guard pre-validates that the stored handler can actually be invoked, failing with this sentinel error when the configuration is wrong.","triggerScenarios":"Thrown at phalcon/Mvc/Micro.zep:711 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a callable to $app->responseHandler()","Or clear the response handler to use the default response behavior"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}