Exception while invoking TaskListener: unsupported variable scope type: org.activiti.engine.impl.persistence.entity.TaskEntity

I finally managed to get Flowable 6.0.1 to start after update from Activiti > Flowable 5.23.0 > 6.0.1. I have a few existing processes that are marked v5 and now I am testing them. One of the issue I ran into is with TaskListener. The exception I am getting is:

Exception while invoking TaskListener: Exception while invoking TaskListener: unsupported variable scope type: org.activiti.engine.impl.persistence.entity.TaskEntity

The process goes from the start form to create a user task that has two ScriptTaskListeners:

    <activiti:taskListener event="create" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
      <activiti:field name="language">
        <activiti:string><![CDATA[javascript]]></activiti:string>
      </activiti:field>
      <activiti:field name="script">
        <activiti:string><![CDATA[runtimeService.setVariableLocal(task.getExecutionId(), 'action', null);]]></activiti:string>
      </activiti:field>
    </activiti:taskListener>

    <activiti:taskListener event="complete" class="org.activiti.engine.impl.bpmn.listener.ScriptTaskListener">
      <activiti:field name="language">
        <activiti:string><![CDATA[javascript]]></activiti:string>
      </activiti:field>
      <activiti:field name="script">
        <activiti:string><![CDATA[runtimeService.setVariable(task.getExecution().getProcessInstanceId(), 'actionTemp', task.getVariable('action'));]]></activiti:string>
      </activiti:field>
    </activiti:taskListener>

The process fails for v5 only. If I redeploy the process as version 6, it works just fine. I assume I am missing something in my compatibility configuration? Any ideas?

How does your TaskListener implementation look like? Does it uses the TaskEntity from the flowable package? If so, those implementations can’t be mixed, either the listener is used for a v5 process or for a v6 (but not for both).