Error message of BPMN error from external task


I want to throw a bpmn error event from external tasks. The external task service provides a handleBpmnError-method, but the method does not take an error message, only the error code. But in camunda modeler I can map an error message to a process instance variable. Also the BpmnError class contains a field for error message.

Is there a way to use error messages for bpmn errors in context of external tasks, too?

Thanks in advance!


Hi Carsten,

currently, it’s not possible to provide an error message.
Feel free to open a new feature request (or work on a pull request) :slight_smile:

Best regards,

Hi Team,

i also looking same solution. In addition there is option to set the variable map in handleBpmnError-method but not getting added in process variable (execution context).

Is there any fix is made for the same , if yes then which version of Camunda.

In the latest version you can send back an error code.
You can check out the docs here.

Hi Niall,


I am able to get the error code value from process, but error message map values i am not able get task service which connected from error boundary event.

ExternalTaskClient client = ExternalTaskClient.create().baseUrl(getEngineUrl()).asyncResponseTimeout(getAsyncResponseTimeout()).disableBackoffStrategy().workerId(getWorkerId()).build();
// Subscribe to the topic
.handler((externalTask, externalTaskService) → {
}catch(Exception exception)
Map<String, Object> errorVariableMap = new HashMap<>();
errorVariableMap.put(“exceptionCode”, “1000”);
errorVariableMap.put(“exceptionMessage”, “Mandatory data not provided”);
externalTaskService.handleBpmnError(externalTask, “5000”, “Mandatory data not provided”, errorVariableMap);

Now my question,

Currently the “5000” value i get from process instance variable. Similarly,

How to get “Mandatory data not provided” value from process as part of errorMessage input handleBpmnError method?
How to get errorVariableMap value from process?

Form the below diagram, i need get the errorMessage and errorVariableMap on External Task Two.

In you’re BPMN model there is a field for Error Message Variable you need to add a value in there, this will be the variable name which holds the value returned by the external task.

Hi Niall,

Still i am not getting the message after changed as per you requesteddiagram_1.bpmn (4.4 KB)

Please find the bpmn attached for your reference.

If possible the please make changes and provide the updated bpmn back.

Your help is appreciated.

This should work

Hi Niall,

No luck :frowning: Still same issue.

Hi Niall,

My bad , i am using the old version of Camunda engine.

With the latest 7.11 version of Camunda engine works fine. Thanks a lot.

Thanks for the support.

@RAMABATHIRANK that’s good to hear you solved the problem. Also make sure you are using correct version compatibility of spring and camunda versions.

Sure Aravind.