I have a process that contains a multi-instance user task node with the completion condition set to: numberOfCompletedInstances = 1 , meaning the task is completed once a single user processes it.
When users A and B process the task simultaneously, under normal circumstances, one of the users should encounter an exception when calling the newUserTaskCompleteCommand method. However, in practice, we observed that both users were able to successfully execute the newUserTaskCompleteCommand without any exception being thrown. The resulting data is as follows:
Thank you for reporting this issue. Based on your description, this appears to be unexpected behavior that contradicts the documented functionality of multi-instance user tasks in Camunda 8.
Expected Behavior
According to the Camunda 8 documentation, when you have a multi-instance user task with a completion condition like numberOfCompletedInstances = 1, the following should happen during concurrent completion attempts:
First user completes their task → Task marked as COMPLETED
Completion condition is met → Multi-instance body completes
Remaining active instances are automatically CANCELED
Second user attempts completion → Should receive a 404 NOT_FOUND error because their task instance was canceled
Your Observed Behavior vs. Expected
What you observed:
Both users successfully execute newUserTaskCompleteCommand without exceptions
User A’s task: COMPLETED
User B’s task: CANCELED
What should happen:
User A successfully completes (task marked as COMPLETED)
User B should receive a 404 NOT_FOUND exception when attempting completion
User B’s task: CANCELED (but the completion command should fail)
Is This a Known Bug?
Based on my research, this specific behavior where both completion commands succeed without throwing the expected 404 NOT_FOUND error is not documented as expected behavior. This suggests it could be a bug in zeebe-client-java version 8.7.2.
Recommendations
Verify your setup: Double-check that your completion condition is correctly configured as numberOfCompletedInstances = 1
Test with error handling: Add proper exception handling around your newUserTaskCompleteCommand calls to catch and log any exceptions that might be occurring
Report the issue: Since this appears to be a deviation from expected behavior, I recommend filing a bug report at the Camunda GitHub repository with:
Your exact process model (BPMN)
Complete version information (Camunda 8 version, zeebe-client-java 8.7.2)
Steps to reproduce the concurrent completion scenario
Expected vs. actual behavior
Workaround
Until this is resolved, you might want to implement application-level checks to handle the race condition gracefully, such as checking the task state before attempting completion or implementing proper error handling for concurrent scenarios.
Would you be able to share your BPMN model and the exact code you’re using for task completion? This would help in providing more specific guidance and potentially reproducing the issue.
The Multi-instance node is a multi-instance UserTask node. The previous node First node writes the processor of Multi-instance into the process variables upon completion. During actual operation, it was found that multiple users can successfully execute the newUserTaskCompleteCommand command at the Multi-instance node.
This is an occasional phenomenon and cannot be reproduced every time.
Thank you for providing the additional details and the BPMN file! This helps clarify the situation.
Analysis
Based on your setup:
Camunda Engine Version: 8.7.6
zeebe-client-java Version: 8.7.2
Multi-instance UserTask with completion condition numberOfCompletedInstances = 1
The behavior you’re experiencing—where multiple users can successfully execute newUserTaskCompleteCommand without receiving the expected 404 NOT_FOUND exception—is definitely not the documented expected behavior.
Key Questions for Troubleshooting
Since I can’t directly examine your BPMN file, could you please confirm:
Multi-instance Configuration:
What is your Input Collection configured as? (e.g., a list of users/assignees)
What is your Input Element variable name?
Is the Completion Condition exactly numberOfCompletedInstances = 1?
Task Assignment:
How are the individual user task instances being assigned to users?
Are you using the assignee property or candidate groups?
Timing Details:
How close in time are the concurrent completion attempts? (milliseconds, seconds?)
Are you seeing this consistently or only occasionally?
This Appears to Be a Bug
Based on my research, this behavior is not documented anywhere as expected functionality. The fact that both completion commands succeed without throwing the expected 404 NOT_FOUND error suggests this could be a race condition bug in either:
The Camunda Engine 8.7.6
The zeebe-client-java 8.7.2 library
Or the interaction between them
Recommended Next Steps
File a Bug Report: I strongly recommend filing this as a bug report at the Camunda GitHub repository with:
Your BPMN file
Exact version information (Engine 8.7.6, Client 8.7.2)
Steps to reproduce the concurrent completion
Expected vs. actual behavior
Any relevant logs
Immediate Workaround: Consider implementing application-level synchronization or checking task state before completion attempts to handle this race condition gracefully.
Version Testing: If possible, you might want to test with the latest versions to see if this has been resolved in newer releases.
Expected Behavior Reminder
The correct sequence should be:
User A completes → Task marked COMPLETED, completion condition met
Multi-instance body completes → User B’s task automatically CANCELED
User B attempts completion → Should receive 404 NOT_FOUND exception
The fact that step 3 is not happening as expected indicates a potential bug in the concurrent handling logic.
Would you be able to share the specific multi-instance configuration details from your BPMN? This would help in providing more targeted guidance for the bug report.