Service task completes despite BpmnError

Hello there!

I have a sub-process where I’m handling BpmnErrors (throwing one inside of service tasks if a job has no retries left).
But Engine seems to be missing output variable inside the service task (Cannot resolve identifier ${…}).
The service task has asyncBefore continuation.
Am I missing something, because there is no such problem when I’m throwing simple java exception (the execution of service task stops in this case).

The way, BpmnError is being thrown:

} catch (Exception ex){
            
            var jobContext = Context.getJobExecutorContext();
            if (jobContext != null && jobContext.getCurrentJob() != null){
                if (jobContext.getCurrentJob().getRetries() <= 1){
                    throw new BpmnError("NoJobRetryLeftCode", ex.getMessage());
                }
            }
            throw ex;
        }

Hi @Zodd,

It might be related to the implementation/technical details of the service task connected to the boundary error event (Notify initiator about an error). Can you please share your model.

Yep, here it is:
SearchClientProcess.bpmn (6.1 KB)

Upd:
The engine missing variable “account” in following process.
Tried to replace BPMNError for java exception (and catch by full-qualified classname), and the result hasn’t changed.

Hi @Zodd,

Where does initiatorId variable shown as assignment expression to the input parameter (highlighted below) get defined?

Right at the process launch:

runtimeService.startProcessInstanceByKey(
                "SearchClientProcess",
                Map.of("clientId", clientId, "initiatorId", initiatorId)
        );

As a temporary solution, I’ve used the ${execution.getVariable("variableName")} construction to map output variables.