400 BAD_REQUEST "Metadata for document [Example/1] is not empty" error on completeTask without async

Hello. In our project ModulF we are currently trying to incorporate the new A12 Workflows structure. While trying to do this the following error occured when trying to complete a task: 400 BAD_REQUEST “Metadata for document [Example/1] is not empty”

We need the completion of a task to be synchronous and not async because with an asynchronous completion the new task metadata is not available sometimes when the user tries to work with the next task. We are using the 2023.06 ext4 Versions and no async in our bpmn model.

We already asked the workflows team if it is possible to have the call be sync and the answer was (to my knowledge) yes. What should we do different/include to ensure the error is not thrown and the metadata is set correctly?

Hi, my project got the same problem, and our work around is:
In camunda, we check and wait until metadata is updated to document before complete user task.

We thought about a custom rpc endpoint that calls completeTask and waits for the metadata change then reports back to the frontend. Do you mean something like this? And I would implement this in dataservices not camunda. Is there a reason you have implemented it in camunda?

No, something different.
In my case, “Metadata for document [Example/1] is not empty”’ is threw when camunda completes user task and tries to update new metadata to DataServices, but at that time the document in Dataservice still has old metadata.

Hi @nick-linked-tensor,

Which config value was set to mgmtp.a12.workflows.outbox.enabled in your project at the moment this error occurred?

Setting it to true means the communication from our workflows-extension to Camunda will be asynchronous. Setting it to false means it will be synchronous (default).

As far as I can see we have not set this at all. So it should default to false.

In that case, I’d recommend first trying to add a “savepoint” in between two user tasks by setting the first user task “async after” in BPMN.

Alternatively, you could try setting outbox.enabled=true (experimental) which should also solve the error you posted.

FYI, I recently discussed the same with @daniel-radiant-elm.

I will give it a try. Thank you. And i will discuss this further with @daniel-radiant-elm as soon he is available again.