ENGINE-16004 Exception occurred while closing the command context

Hello everyone, I would like to ask a question. When using Camunda Platform 7, I approve a task process, the following error occurs: ENGINE-16004 Exception while closing command context: Cannot construct activity-execution mapping: there are more scope executions missing than explained by the flow scope hierarchy. Can anyone assist me with this?

When I reviewed the logs, it appeared that during the transition from the previous node to the next node, some data was not deleted.

2025-03-04 11:56:33.003 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03006 Cache state after flush: [
  PERSISTENT HistoricActivityInstanceEntity[null]
  PERSISTENT ProcessDefinitionEntity[Process_1qfk5tu:1:54dd0928-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT TaskMeterLogEntity[a949bcc8-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT VariableInstanceEntity[a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT TaskEntity[a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricActivityInstanceEventEntity[Activity_1ungdlo:5eafaf2c-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricActivityInstanceEventEntity[Activity_1ctejy8:a949bcc3-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricVariableInstanceEntity[a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricTaskInstanceEventEntity[5eb2e37f-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricTaskInstanceEventEntity[a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricIdentityLinkLogEventEntity[a949bcc7-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT ExecutionEntity[5eac53c9-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT ExecutionEntity[5eaf881b-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT ExecutionEntity[a94995b2-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricVariableUpdateEventEntity[a949bcc5-f8ac-11ef-8ebc-fa163ea5b1a7]
  PERSISTENT HistoricTaskInstanceEntity[null]
]
2025-03-04 11:56:33.003 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03008 Flush Summary: [
  INSERT TaskMeterLogEntity[a949bcc8-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT HistoricVariableInstanceEntity[a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT HistoricVariableUpdateEventEntity[a949bcc5-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT HistoricTaskInstanceEventEntity[a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT HistoricIdentityLinkLogEventEntity[a949bcc7-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT HistoricActivityInstanceEventEntity[Activity_1ctejy8:a949bcc3-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT ExecutionEntity[a94995b2-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT TaskEntity[a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]
  INSERT VariableInstanceEntity[a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]
  DELETE TaskEntity[5eb2e37f-f8ac-11ef-8ebc-fa163ea5b1a7]
  UPDATE ExecutionEntity[5eaf881b-f8ac-11ef-8ebc-fa163ea5b1a7]
  UPDATE HistoricActivityInstanceEventEntity[Activity_1ungdlo:5eafaf2c-f8ac-11ef-8ebc-fa163ea5b1a7]
  UPDATE HistoricTaskInstanceEventEntity[5eb2e37f-f8ac-11ef-8ebc-fa163ea5b1a7]
]
2025-03-04 11:56:33.004 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'TaskMeterLogEntity[id=a949bcc8-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.004 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'HistoricVariableInstanceEntity[id=a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.004 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'HistoricVariableUpdateEventEntity[id=a949bcc5-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.005 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'HistoricTaskInstanceEventEntity[id=a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.005 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'HistoricIdentityLinkLogEventEntity[id=a949bcc7-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.006 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'HistoricActivityInstanceEventEntity[id=Activity_1ctejy8:a949bcc3-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.006 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'ExecutionEntity[id=a94995b2-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.006 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'TaskEntity[id=a949bcc6-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.007 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'INSERT'; Entity: 'VariableInstanceEntity[id=a949bcc4-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.007 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'DELETE'; Entity: 'TaskEntity[id=5eb2e37f-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.007 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'UPDATE'; Entity: 'ExecutionEntity[id=5eaf881b-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.008 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'UPDATE'; Entity: 'HistoricActivityInstanceEventEntity[id=Activity_1ungdlo:5eafaf2c-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.009 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03009 SQL operation: 'UPDATE'; Entity: 'HistoricTaskInstanceEventEntity[id=5eb2e37f-f8ac-11ef-8ebc-fa163ea5b1a7]'
2025-03-04 11:56:33.026 DEBUG 2005630 --- [http-nio-10002-exec-9] org.camunda.bpm.engine.persistence       : ENGINE-03006 Cache state after flush: [
  PERSISTENT ExecutionEntity[5eac53c9-f8ac-11ef-8ebc-fa163ea5b1a7]
]