flowable/flowable-engine · error · FlowableException

Cannot autoMap activity migration for '" +…

Error message

Cannot autoMap activity migration for '" + executionActivityId + "'. Cannot migrate arbitrarily inside a Multi Instance container '" + newFlowElementMIParentId

What it means

Thrown during auto-mapping when an activity sits inside a multi-instance container in the new model, the multi-instance element's content changed between models (nested MI, changed collection, not same sub-process content), and no explicit mapping exists. Arbitrary movement inside a changed multi-instance container would corrupt instance state.

Solutions

  1. Add an explicit activity mapping (mapping the MI parent) in the migration document
  2. Revert the multi-instance changes in the target model so content matches (hasSameSubProcessContent passes)
  3. Wait until instances exit the changed multi-instance branch, then migrate
  4. Split migration: complete current model branch, deploy compatible intermediate model, then migrate

Example fix

// before
runtimeService.createProcessInstanceMigrationBuilder().migrateToProcessDefinition(v2).migrate(id); // MI content changed
// after
runtimeService.createProcessInstanceMigrationBuilder().migrateToProcessDefinition(v2)
    .addActivityMapping("stepInMI", "stepInMI").migrate(id);
Defensive patterns

Strategy: validation

Validate before calling

// detect changed MI parent content before migrating
FlowElement oldMI = getFlowElementMultiInstanceParentId(oldModel, activityId) != null ? oldModel.getFlowElement(miParentId) : null;
FlowElement newMI = newModel.getFlowElement(miParentId);
if (oldMI != null && newMI != null && !hasSameSubProcessContent((SubProcess) oldMI, (SubProcess) newMI)) {
    // add explicit mapping
}

Try / catch

try {
    migrationBuilder.migrate(instanceId);
} catch (FlowableException e) {
    if (e.getMessage().contains("Cannot migrate arbitrarily inside a Multi Instance container")) {
        // add explicit activity mapping for the MI parent
    }
}

Prevention

When it happens

Trigger: Migrating a running activity into a multi-instance parent whose structure changed (nested multi-instance added, changed collectionExpression, or altered embedded sub-process content) without providing an explicit activity mapping.

Common situations: New model version adds multi-instance to a sub-process containing the running activity; changing the loop collection; nesting MI inside MI; editing the sub-process content of an active MI element.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/07cac96d36f54243. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/migration/ProcessInstanceMigrationManagerImpl.java:741

                    FlowElement newModelFlowElement = newModel.getFlowElement(executionActivityId);
                    String newFlowElementMIParentId = getFlowElementMultiInstanceParentId(newModelFlowElement);

                    if (newFlowElementMIParentId != null) {
                    	boolean noChangesInMI = false;
                    	Activity currentMIElement = (Activity) currentModel.getFlowElement(newFlowElementMIParentId);
                    	Activity newMIElement = (Activity) newModel.getFlowElement(newFlowElementMIParentId);
                    	if (currentMIElement.getClass().getName().equals(newMIElement.getClass().getName()) &&
                    			hasSameLoopCharacteristics(currentMIElement, newMIElement)) {
                    		
                    		if (!(currentMIElement instanceof SubProcess)) {
                    			noChangesInMI = true;
                    		} else if (hasSameSubProcessContent((SubProcess) currentMIElement, (SubProcess) newMIElement)) {
                    			noChangesInMI = true;
                    		}
                    	}
                    	
                    	if (!noChangesInMI) {
                    		throw new FlowableException("Cannot autoMap activity migration for '" + executionActivityId + "'. Cannot migrate arbitrarily inside a Multi Instance container '" + newFlowElementMIParentId);
                    	}
                    }

                    LOGGER.debug("Auto mapping activity '{}'", executionActivityId);
                    List<ExecutionEntity> executionEntities = filteredExecutionsByActivityId.get(executionActivityId);
                    if (executionEntities.size() > 1) {
                        List<String> executionIds = executionEntities.stream().map(ExecutionEntity::getId).collect(Collectors.toList());
                        mainProcessChangeActivityStateBuilder.moveExecutionsToSingleActivityId(executionIds, executionActivityId);
                    } else {
                        mainProcessChangeActivityStateBuilder.moveExecutionToActivityId(executionEntities.get(0).getId(), executionActivityId);
                    }
                    
                } else {
                    if (!(currentModelFlowElement instanceof CallActivity)) {
                        throw new FlowableException("Migration Activity mapping missing for activity definition Id:'" + 
                        		executionActivityId + "' or its MI Parent");
                    }
                }

View on GitHub (pinned to d6d39ce1c6)