Workflow Extension without UAA throws Exception

The issue probable lies within the process design, but I am not able to track the real cause.
We have two services, one dataservice and one service with the workflows extension.
The dataservice works fine, and can connect to the workflow-service without authentication. The workflow-service is able to connect to the dataservice via certificate, which also works.

The workflow service has the following dependencies

<dependency>
  <groupId>com.mgmtp.a12.workflows</groupId>
  <artifactId>workflows-shared</artifactId>
  <version>${mgm.a12.workflows.version}</version>
  <exclusions>
    <exclusion>
      <groupId>com.mgmtp.a12.uaa</groupId>
      <artifactId>uaa-authentication</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.mgmtp.a12.uaa</groupId>
      <artifactId>uaa-authentication-user-extension</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.mgmtp.a12.uaa</groupId>
      <artifactId>uaa-authentication-user-extension-spring-boot-autoconfigure</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>com.mgmtp.a12.uaa</groupId>
  <artifactId>uaa-rest-client</artifactId>
</dependency>
<dependency>
  <groupId>com.mgmtp.a12.uaa</groupId>
  <artifactId>uaa-rest-client-spring-boot-autoconfigure</artifactId>
</dependency>

also camunda etc.

We have a process which is started by the dataservice (works) and goes trhough a few steps:

  • Service Task - syncAvailableFieldsDelegate
  • User Task with a form and a assignement task listener as a Delegate which deletes the metadata of the same task and completes the task. We use this, as far as I understood, to get a document, which we can further modify, before a new user task gets created.
  • Service Task - setDocumentFieldDelegate
  • … other steps

task listener:

@Slf4j
@Component
@RequiredArgsConstructor
public class AutoCompleteTaskListener implements TaskListener {
private final DataServicesRpcFacade dataServicesRpcFacade;

    @Override
    public void notify(DelegateTask delegateTask) {
        log.info("AutoCompleteListener.onTaskCreate for task {} was triggered", delegateTask.getTaskDefinitionKey());
        Object newDocRef = delegateTask.getVariable("newDocRef");
        dataServicesRpcFacade.tryRemoveMetadata(new DocumentReference(newDocRef.toString()));
        delegateTask.complete();
    }
}

With the previous UAA integration (Roles etc, all which we use to secure the dataservice) this works fine, without it, after removing uaa-authentication etc. this throws me an error “task is null”

The error does get thrown when I try to delete the metadata, via tryToRemoveMetadata. I observed the following log message:

2025-10-30 15:40:50.321 [        ]  INFO [service-camunda,69038700511a897af8104c9067a7ae55,f8104c9067a7ae55] 1 --- [nio-8120-exec-7] c.t.s.t.i.c.AutoCompleteTaskListener     : AutoCompleteListener.onTaskCreate for task fragebogen-erstellen was triggered
2025-10-30T15:40:50.426531179Z 2025-10-30 15:40:50.426 [        ] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] o.s.w.f.CommonsRequestLoggingFilter      : Before request [POST /engine-rest/task/cf8abdb4-b5a6-11f0-8798-a6ca915d712f/variables, client=ip_range]
2025-10-30T15:40:50.467658303Z 2025-10-30 15:40:50.467 [        ] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] org.camunda.bpm.engine.cmd               : ENGINE-13005 Starting command -------------------- PatchTaskVariablesCmd ----------------------
2025-10-30T15:40:50.468335540Z 2025-10-30 15:40:50.468 [        ] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] org.camunda.bpm.engine.cmd               : ENGINE-13009 opening new command context
2025-10-30T15:40:50.468623894Z 2025-10-30 15:40:50.468 [ MYBATIS] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] o.c.b.e.i.p.e.TaskEntity.selectTask      : ==>  Preparing: select * from ACT_RU_TASK where ID_ = ?
2025-10-30T15:40:50.468709601Z 2025-10-30 15:40:50.468 [ MYBATIS] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] o.c.b.e.i.p.e.TaskEntity.selectTask      : ==> Parameters: cf8abdb4-b5a6-11f0-8798-a6ca915d712f(String)
2025-10-30T15:40:50.471215097Z 2025-10-30 15:40:50.471 [ MYBATIS] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] o.c.b.e.i.p.e.TaskEntity.selectTask      : <==      Total: 0
2025-10-30T15:40:50.471513897Z 2025-10-30 15:40:50.471 [        ] DEBUG [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] org.camunda.bpm.engine.cmd               : ENGINE-13011 closing existing command context
2025-10-30T15:40:50.473754975Z 2025-10-30 15:40:50.472 [        ] ERROR [service-camunda,69038702a45b370510e95cc9503b31f3,10e95cc9503b31f3] 1 --- [nio-8120-exec-8] org.camunda.bpm.engine.context           : ENGINE-16004 Exception while closing command context: task cf8abdb4-b5a6-11f0-8798-a6ca915d712f doesn't exist: task is null
2025-10-30T15:40:50.473759791Z 
2025-10-30T15:40:50.473761581Z org.camunda.bpm.engine.exception.NullValueException: task cf8abdb4-b5a6-11f0-8798-a6ca915d712f doesn't exist: task is null
2025-10-30T15:40:50.473763340Z 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2025-10-30T15:40:50.473765099Z 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
2025-10-30T15:40:50.473766817Z 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
2025-10-30T15:40:50.473768561Z 	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
2025-10-30T15:40:50.473770380Z 	at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
2025-10-30T15:40:50.473772084Z 	at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:398)
2025-10-30T15:40:50.473773841Z 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:55)
2025-10-30T15:40:50.473782039Z 	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:50)

With A12 UAA I only get the DB request which still returns 0 but doesn’t throw an error, but I do not get the patch, at least not there.

We don’t use any async before or after checks, but when I change my process and introduce these transaction barriers, the error stays.
When I change the tasklistener from assignee to timeout with onme second timeout, the error vanishes but the data is still not right and the process dies a moment later with a different Exception.

My guess is, that we found a race condition in our process, which previously was covered through something from UAA, but now isn’t.

Any ideas?

Hello @raiko-static-field , thanks for your post within A12 discourse! We’ve forwarded your request to our Workflows team. As they are currently very busy, there may be delays in processing. We apologize for this and hope to be able to provide an answer in a timely manner.

Your discourse team

Hi @raiko-static-field

Is the A12 version in your tags correct, i.e. you are using 2023.06? If so, please consider upgrading to one of our later release lines, as version 2023.06 is no longer supported with security patches and bug fixes.

Regarding your problem: Did I understand your setup correctly? Is your UAA setup as described in your other discourse thread, i.e. you removed the UAA authentication from Camunda so that Camunda is unsecured, and Camunda is configured to use UAA Certificate authentication to communicate with Dataservices?

We found the issue but postponed the solution.

Yes we are using a deprecated version. We can barely keep up with the iirc 2 year LTS versions, it takes a lot of time to update A12. Anyway, we are currently updating to ext 11 and SB 3.4/3.5 and will move on to A12 2024 after that, next year, and hopefully also 2025, maybe.

Regarding the setup, we removed A12 uaa from our camunda service, because we do not need it. That service exclusivly talks to our A12 data service.

The underlying issue is our process/handling setup. There is a process variable, which will be initialized/updated before our tasklistener and the user task step is reached. I think it gets created through CreateMetaData - somehow this also creates an update on said variable. With uaa in place, this update gets refused (access denied), without this update gets through.
Later the tryRemoveMetadata executes and failes, because the task is not created yet, in DB - I think also because now a request gets through which should not get through, but I am not sure.
Anyway, we delete the task again, which also tries to delete the process variable, and because all of this happens inside a transaction we break at the moment these operations need to be executed with a ConcurrentUpdateException.
We cannot easily prevent the update, but we also need the task, because we need the document for manipulations (other ways seem to be way more complex getting a document object), and only for that. To prevent stopping there, we need to complete it again, then do our manipulations and then get a real user task. At that moment the transaction breaks.

The solution for us is to wait for the A12 update on 2024 where it should be possible to easily create a document without a user task.

Any other way is too complex (document + our changes on that + task) its just to big of a change.
UAA actually covered this issue for us, if we wouldn’t have used uaa in the first place we would’ve seen the issues coming with that pseudo-task setup.