{"record":{"id":"248f556f50fe0444","repo":"flowable/flowable-engine","slug":"delegate-expression-expression-did-not-res","errorCode":null,"errorMessage":"Delegate expression \" + expression + \" did not resolve to an implementation of \" + HttpRequestHandler.class","messagePattern":"Delegate expression \" \\+ expression \\+ \" did not resolve to an implementation of \" \\+ HttpRequestHandler\\.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":51,"sourceCode":" */\npublic class DelegateExpressionHttpHandler implements HttpRequestHandler, HttpResponseHandler {\n\n    protected Expression expression;\n    protected final List<FieldDeclaration> fieldDeclarations;\n\n    public DelegateExpressionHttpHandler(Expression expression, List<FieldDeclaration> fieldDeclarations) {\n        this.expression = expression;\n        this.fieldDeclarations = fieldDeclarations;\n    }\n\n    @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() {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/handler/DelegateExpressionHttpHandler.java#L33-L69","documentation":"Thrown as FlowableIllegalArgumentException when a delegate expression configured for an HTTP request handler (flowable:class / delegateExpression on the HTTP task request handler) resolves to an object that does not implement org.flowable.http.HttpRequestHandler. Flowable requires the resolved delegate to be an HttpRequestHandler so it can wrap it in HttpRequestHandlerInvocation and route the HTTP request handling through the delegate interceptor. This is a configuration/typing contract check.","triggerScenarios":"A BPMN HTTP task defines flowable:delegateExpression (e.g. ${myHandlerBean}) for the request handler, the expression is evaluated at request-handling time via DelegateExpressionUtil.resolveDelegateExpression, and the returned object fails the `instanceof HttpRequestHandler` check.","commonSituations":"Pointing the delegate expression at a Spring bean that is an ExecutionListener or plain class instead of HttpRequestHandler; typo/EL resolving to the wrong bean; a bean refactored to no longer implement HttpRequestHandler after a Flowable version change; expression accidentally resolving to null or to a String.","solutions":["Make the class the expression points to implement org.flowable.http.HttpRequestHandler (handleHttpRequest method).","Check the delegateExpression value in the BPMN XML to confirm it resolves to the intended bean and not another bean with a similar name.","If the object only needs to be a listener, use the appropriate listener configuration instead of the HTTP handler delegateExpression.","Add a startup-time check in your app (e.g. a Spring test that resolves each handler bean and asserts instanceof HttpRequestHandler) to fail fast."],"exampleFix":"// before\npublic class MyHandler { public void handle(VariableContainer c) { ... } }\n\n// after\nimport org.flowable.http.HttpRequestHandler;\npublic class MyHandler implements HttpRequestHandler {\n    public void handleHttpRequest(VariableContainer execution, HttpRequest request, FlowableHttpClient client) { ... }\n}","handlingStrategy":"type-guard","validationCode":"Object delegate = DelegateExpressionUtil.resolveDelegateExpression(expression, execution);\nif (!(delegate instanceof HttpRequestHandler)) {\n    throw new IllegalStateException(\"Bean for \" + expression + \" must implement HttpRequestHandler\");\n}","typeGuard":"boolean isValidHttpRequestDelegate(Object o) {\n    return o instanceof org.flowable.http.HttpRequestHandler;\n}","tryCatchPattern":"try {\n    delegateHandler.handleHttpRequest(execution, request, client);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"did not resolve to an implementation of\")) {\n        logger.error(\"HTTP request handler delegate misconfigured: \" + e.getMessage());\n    } else { throw e; }\n}","preventionTips":["Always implement HttpRequestHandler for beans referenced by HTTP request delegateExpressions.","Add a Spring integration test asserting handler beans implement the right interface.","Use distinct bean names for request vs response handlers to avoid cross-wiring.","Resolve and type-check handler expressions at process deployment time."],"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"}