{"record":{"id":"d1ea18761102d32b","repo":"flowable/flowable-engine","slug":"delegate-expression-expression-did-not-res-d1ea18","errorCode":null,"errorMessage":"Delegate expression \" + expression + \" did not resolve to an implementation of \" + HttpResponseHandler.class","messagePattern":"Delegate expression \" \\+ expression \\+ \" did not resolve to an implementation of \" \\+ HttpResponseHandler\\.class","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/handler/DelegateExpressionHttpHandler.java","lineNumber":62,"sourceCode":"    @Override\n    public void handleHttpRequest(VariableContainer execution, HttpRequest httpRequest, FlowableHttpClient client) {\n        Object delegate = DelegateExpressionUtil.resolveDelegateExpression(expression, execution, fieldDeclarations);\n        if (delegate instanceof HttpRequestHandler) {\n            CommandContextUtil.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(\n                            new HttpRequestHandlerInvocation((HttpRequestHandler) delegate, execution, httpRequest, client));\n        } else {\n            throw new FlowableIllegalArgumentException(\"Delegate expression \" + expression + \" did not resolve to an implementation of \" + HttpRequestHandler.class);\n        }\n    }\n\n    @Override\n    public void handleHttpResponse(VariableContainer execution, HttpResponse httpResponse) {\n        Object delegate = DelegateExpressionUtil.resolveDelegateExpression(expression, execution, fieldDeclarations);\n        if (delegate instanceof HttpResponseHandler) {\n            CommandContextUtil.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(\n                            new HttpResponseHandlerInvocation((HttpResponseHandler) delegate, execution, httpResponse));\n        } else {\n            throw new FlowableIllegalArgumentException(\"Delegate expression \" + expression + \" did not resolve to an implementation of \" + HttpResponseHandler.class);\n        }\n    }\n\n    /**\n     * returns the expression text for this execution listener. Comes in handy if you want to check which listeners you already have.\n     */\n    public String getExpressionText() {\n        return expression.getExpressionText();\n    }\n}\n","sourceCodeStart":44,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/handler/DelegateExpressionHttpHandler.java#L44-L73","documentation":"Thrown as FlowableIllegalArgumentException when a delegate expression configured for an HTTP response handler resolves to an object that does not implement org.flowable.http.HttpResponseHandler. During response handling Flowable evaluates the delegate expression and requires the result to be an HttpResponseHandler so it can be wrapped in HttpResponseHandlerInvocation. Same contract as the request-side check but for responses.","triggerScenarios":"A BPMN HTTP task defines a delegateExpression for the response handler; when the HTTP response arrives, DelegateExpressionUtil.resolveDelegateExpression returns an object that fails `instanceof HttpResponseHandler` in DelegateExpressionHttpHandler.handleHttpResponse.","commonSituations":"Reusing the same bean for both request and response handler when it implements only HttpRequestHandler; bean refactoring dropped the HttpResponseHandler interface; EL expression typo resolving to the wrong bean; copying config from a request-handler example.","solutions":["Make the class implement org.flowable.http.HttpResponseHandler (handleHttpResponse method).","If one bean must handle both, implement both HttpRequestHandler and HttpResponseHandler.","Verify the delegateExpression in the BPMN XML resolves to the intended response-handler bean.","Add a unit test that resolves the bean and asserts `bean instanceof HttpResponseHandler` before deploying the process."],"exampleFix":"// before\npublic class MyHandler implements HttpRequestHandler { ... }\n\n// after\nimport org.flowable.http.*;\npublic class MyHandler implements HttpRequestHandler, HttpResponseHandler {\n    public void handleHttpRequest(VariableContainer e, HttpRequest r, FlowableHttpClient c) { ... }\n    public void handleHttpResponse(VariableContainer e, HttpResponse r) { ... }\n}","handlingStrategy":"type-guard","validationCode":"Object delegate = DelegateExpressionUtil.resolveDelegateExpression(expression, execution);\nif (!(delegate instanceof HttpResponseHandler)) {\n    throw new IllegalStateException(\"Bean for \" + expression + \" must implement HttpResponseHandler\");\n}","typeGuard":"boolean isValidHttpResponseDelegate(Object o) {\n    return o instanceof org.flowable.http.HttpResponseHandler;\n}","tryCatchPattern":"try {\n    delegateHandler.handleHttpResponse(execution, response);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"did not resolve to an implementation of\")) {\n        logger.error(\"HTTP response handler delegate misconfigured: \" + e.getMessage());\n    } else { throw e; }\n}","preventionTips":["Implement HttpResponseHandler on any bean used as an HTTP response delegateExpression.","If one bean handles both request and response, implement both interfaces.","Verify bean resolution in tests before deploying the process definition.","Keep request- and response-handler beans in separate classes when only one side is needed."],"tags":["delegate-expression","http-handler","type-mismatch","bpmn-config"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}