{"record":{"id":"0d0514df16e40d7a","repo":"flowable/flowable-engine","slug":"exception-while-processing-exchange","errorCode":null,"errorMessage":"Exception while processing exchange","messagePattern":"Exception while processing exchange","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-camel/src/main/java/org/flowable/camel/CamelBehavior.java","lineNumber":130,"sourceCode":"        }\n    }\n\n    @Override\n    public void execute(DelegateExecution execution) {\n        boolean isV5Execution = false;\n        if ((Context.getCommandContext() != null && Flowable5Util.isFlowable5ProcessDefinitionId(Context.getCommandContext(), execution.getProcessDefinitionId())) ||\n            (Context.getCommandContext() == null && Flowable5Util.getFlowable5CompatibilityHandler() != null)) {\n\n            isV5Execution = true;\n        }\n\n        final FlowableEndpoint endpoint = createEndpoint(execution, isV5Execution);\n        final Exchange exchange = createExchange(execution, endpoint);\n\n        try {\n            endpoint.process(exchange);\n        } catch (Exception e) {\n            throw new FlowableException(\"Exception while processing exchange\", e);\n        }\n        execution.setVariables(ExchangeUtils.prepareVariables(exchange, endpoint));\n\n        if (!handleCamelException(exchange, execution, isV5Execution)) {\n            if (isV5Execution) {\n                Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n                compatibilityHandler.leaveExecution(execution);\n                return;\n            }\n            leave(execution);\n        }\n    }\n\n    protected FlowableEndpoint createEndpoint(DelegateExecution execution, boolean isV5Execution) {\n        String uri = \"flowable://\" + getProcessDefinitionKey(execution, isV5Execution) + \":\" + execution.getCurrentActivityId();\n        CamelContext camelContext = getCamelContext(execution, isV5Execution);\n        return getEndpoint(camelContext, uri);\n    }","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-camel/src/main/java/org/flowable/camel/CamelBehavior.java#L112-L148","documentation":"CamelBehavior.execute routes the Flowable execution through a Camel endpoint. If the synchronous endpoint.process(exchange) call throws any exception, it is wrapped in a FlowableException 'Exception while processing exchange' with the original as cause.","triggerScenarios":"A Camel route/producer invoked from a service task (camelBehavior) throws: bad route configuration, exception inside the route before completing, endpoint processing failure.","commonSituations":"Misconfigured Camel routes, exceptions thrown inside route processors, serialization failures in exchange body, CamelContext not started.","solutions":["Inspect the cause chain (FlowableException.getCause()) to find the underlying Camel exception","Fix the Camel route/processor that threw the original exception","Check the CamelContext is started and the route is registered before the process runs","Wrap route-side logic so expected business errors are propagated as BPMN errors/exceptions mapped via mapException"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { /* execute task */ } catch (FlowableException e) { log.error(\"Camel processing failed\", e.getCause()); }","preventionTips":["Test Camel routes independently; map expected exceptions with mapException"],"tags":["camel","integration","wrapped-exception"],"backgroundTag":"upstream-api-error","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}