"After" asynchronous continuation causes Camunda UI to incorrectly display error

I am a software engineer who develops a Spring application (Spring-boot 2.6.8) with Camunda 7. I noticed an unexpected behaviour when running a Camunda process which contains “after” asynchronous continuation assigned to a service task. After task A (with “after” asynchronous continuation), we run task B which throws an error. For some reason, the error is displayed in task A instead of task B, despite the fact the task B is at fault here.

Does it mean that task B should have “before” asynchronous continuation option checked, in order to prevent this from happening? What solution would you recommend?

might be a good reference with some do’s and dont’s regarding this topic.

I’d consider it a bug and submit a ticket.

I think It is an expected behavior if you dont have any asyncBefore or after on task B, the transaction is rolled back to last wait state when there is error. In your case the last wait state is TASK A hence the token is moved back to task A and incident is created.
But if you look at incident it will show Failing Activity which should be task B in your case
Something like this