Unable to inject stage dynamically which is repeatable

Currently, I have the one running case instance which has only one task.

At this stage, we tried to inject a stage into the running case Instance. The stage has set “repetition” value to true, also set the flowable:maxInstanceCount=“1”.
eg: case model to be injected

Case definition:

 <case id="TestInject" name="TestInject" flowable:initiatorVariableName="initiator">
    <casePlanModel id="casePlanModel" flowable:formFieldValidation="true">
      <planItem id="planItem2" name="stage1" definitionRef="stage1">
          <repetitionRule flowable:counterVariable="repetitionCounter" flowable:maxInstanceCount="1">
      <stage id="stage1" name="stage1">
        <planItem id="planItem1" name="task1" definitionRef="task1"></planItem>
        <humanTask id="task1" name="task1" flowable:assignee="${initiator}" flowable:formFieldValidation="true">
            <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator>

We are able to inject this stage in the above running case instance using case ‘dynamicCmmnService’. After injection, we are able to get the plan items like myTask1, stage1, task1.

But when try to complete the task ‘task1’ getting Null Pointer exception.

at org.flowable.cmmn.engine.impl.listener.PlanItemLifeCycleListenerUtil.callLifecycleListeners(PlanItemLifeCycleListenerUtil.java:38)
at org.flowable.cmmn.engine.impl.agenda.operation.AbstractMovePlanItemInstanceToTerminalStateOperation.run(AbstractMovePlanItemInstanceToTerminalStateOperation.java:68)
at org.flowable.cmmn.engine.impl.interceptor.CmmnCommandInvoker.executeOperations(CmmnCommandInvoker.java:65)
at org.flowable.cmmn.engine.impl.interceptor.CmmnCommandInvoker.execute(CmmnCommandInvoker.java:51)

Is it possible inject stage which is repeatable? Here we need to inject a stage which is repeatable so that we can trigger the stage again based the requirements.

From the stacktrace, it looks like that’s not possible yet.
What’s the use case you’re trying to solve with the dynamic injection?

Thank you @joram, Thanks for your reply.

Our use case is to try to inject the stages into the running instance such that after injecting stages we can navigate back to the previous stages based on the condition. For navigate back to the stage we need to add the repetition for the stages. Using dynamic injection can we inject the stages which can traverse the previous stages (having repetition of stages/ activities)…

For eg, From the above case model, We want to inject the above stages (stage1, stage2) in to the new running case instance such that after injection of stages we can traverse forward, backward based on our conditions.