{"record":{"id":"ff1b150e48ae6e0f","repo":"flowable/flowable-engine","slug":"cannot-migrate-case-es-not-enough-information-ff1b15","errorCode":null,"errorMessage":"Cannot migrate case(es), not enough information","messagePattern":"Cannot migrate case\\(es\\), not enough information","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CaseInstanceMigrationCmd.java","lineNumber":98,"sourceCode":"        this.caseDefinitionKey = caseDefinitionKey;\n        this.caseDefinitionVersion = caseDefinitionVersion;\n        this.caseDefinitionTenantId = caseDefinitionTenantId;\n        this.caseInstanceMigrationDocument = caseInstanceMigrationDocument;\n        this.cmmnEngineConfiguration = cmmnEngineConfiguration;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CaseInstanceMigrationManager migrationManager = cmmnEngineConfiguration.getCaseInstanceMigrationManager();\n\n        if (caseInstanceId != null) {\n            migrationManager.migrateCaseInstance(caseInstanceId, caseInstanceMigrationDocument, commandContext);\n        } else if (caseDefinitionId != null) {\n            migrationManager.migrateCaseInstancesOfCaseDefinition(caseDefinitionId, caseInstanceMigrationDocument, commandContext);\n        } else if (caseDefinitionKey != null && caseDefinitionVersion >= 0) {\n            migrationManager.migrateCaseInstancesOfCaseDefinition(caseDefinitionKey, caseDefinitionVersion, caseDefinitionTenantId, caseInstanceMigrationDocument, commandContext);\n        } else {\n            throw new FlowableException(\"Cannot migrate case(es), not enough information\");\n        }\n        return null;\n    }\n}\n","sourceCodeStart":80,"sourceCodeEnd":103,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CaseInstanceMigrationCmd.java#L80-L103","documentation":"Thrown in CaseInstanceMigrationCmd.execute() when none of the supported targeting variants is present: neither a case instance id, a case definition id, nor a case definition key with version >= 0 was set. The command has no way to determine which case instance(s) to migrate.","triggerScenarios":"Constructing CaseInstanceMigrationCmd with all target fields null (e.g. a no-arg/default path), or key set but version left as -1/0-unset so `caseDefinitionVersion >= 0` fails.","commonSituations":"Custom code creating the command directly without setting any target; deserializing a migration request where the target selector was omitted; using version sentinel -1 while providing key and tenant.","solutions":["Set exactly one target: call migrateCaseInstance(id, ...) for one instance, or migrateToCaseDefinition(caseDefinitionId), or migrateToCaseDefinition(key, version, tenantId) with version >= 0.","If targeting by key, ensure the version is a real deployed version number (0 or higher), not a sentinel like -1.","Validate the migration request object for a target selector before executing the command."],"exampleFix":"// before\ncmmnEngineConfiguration.getCommandExecutor().execute(new CaseInstanceMigrationCmd(null, -1, null, doc, cfg));\n// after\ncmmnEngineConfiguration.getCommandExecutor().execute(new CaseInstanceMigrationCmd(\"orderCase\", 2, \"tenant1\", doc, cfg));","handlingStrategy":"validation","validationCode":"boolean hasTarget = caseInstanceId != null\n        || caseDefinitionId != null\n        || (caseDefinitionKey != null && caseDefinitionVersion >= 0);\nif (!hasTarget) {\n    throw new IllegalArgumentException(\"provide caseInstanceId, caseDefinitionId, or key+version for migration\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    cmmnEngineConfiguration.getCommandExecutor().execute(migrationCmd);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"not enough information\")) {\n        // request is missing a target selector; reject upstream\n    }\n}","preventionTips":["Validate the migration request object for exactly one target selector before executing.","Do not use sentinel versions like -1; store real deployed version numbers.","Prefer the public builder API over instantiating CaseInstanceMigrationCmd manually."],"tags":["cmmn","case-migration","missing-target","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}