{"record":{"id":"815ea161a724d17f","repo":"flowable/flowable-engine","slug":"must-specify-a-case-definition-tenant-id-to-migrat-815ea1","errorCode":null,"errorMessage":"Must specify a case definition tenant id to migrate","messagePattern":"Must specify a case definition tenant id to migrate","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/HistoricCaseInstanceMigrationCmd.java","lineNumber":71,"sourceCode":"            throw new FlowableException(\"Must specify a case definition id to migrate\");\n        }\n        if (historicCaseInstanceMigrationDocument == null) {\n            throw new FlowableException(\"Must specify a historic case instance migration document to migrate\");\n        }\n        \n        this.caseDefinitionId = caseDefinitionId;\n        this.historicCaseInstanceMigrationDocument = historicCaseInstanceMigrationDocument;\n        this.cmmnEngineConfiguration = cmmnEngineConfiguration;\n    }\n\n    public HistoricCaseInstanceMigrationCmd(String caseDefinitionKey, int caseDefinitionVersion, String caseDefinitionTenantId, \n            HistoricCaseInstanceMigrationDocument historicCaseInstanceMigrationDocument, CmmnEngineConfiguration cmmnEngineConfiguration) {\n        \n        if (caseDefinitionKey == null) {\n            throw new FlowableException(\"Must specify a case definition id to migrate\");\n        }\n        if (caseDefinitionTenantId == null) {\n            throw new FlowableException(\"Must specify a case definition tenant id to migrate\");\n        }\n        if (historicCaseInstanceMigrationDocument == null) {\n            throw new FlowableException(\"Must specify a historic case instance migration document to migrate\");\n        }\n        \n        this.caseDefinitionKey = caseDefinitionKey;\n        this.caseDefinitionVersion = caseDefinitionVersion;\n        this.caseDefinitionTenantId = caseDefinitionTenantId;\n        this.historicCaseInstanceMigrationDocument = historicCaseInstanceMigrationDocument;\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.migrateHistoricCaseInstance(caseInstanceId, historicCaseInstanceMigrationDocument, commandContext);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/HistoricCaseInstanceMigrationCmd.java#L53-L89","documentation":"The HistoricCaseInstanceMigrationCmd constructor requires a caseDefinitionTenantId; if it is null the constructor throws this FlowableException. Multi-tenant migrations need the tenant id to scope the case definition lookup (key+version+tenant together identify the definition), so a missing tenant makes the migration ambiguous and is rejected up front.","triggerScenarios":"Constructing HistoricCaseInstanceMigrationCmd with a non-null key and version but a null caseDefinitionTenantId — typically when the tenant was omitted from a migration builder or config for a multi-tenant deployment.","commonSituations":"Single-tenant setups copied into multi-tenant environments where tenant ids are now mandatory; builders where setTenantId() was never called; reading tenant from a null request header/property.","solutions":["Provide the tenant id of the case definition as the third constructor argument","If the deployment has no tenants, pass an explicit empty/zero-tenant value consistent with how definitions were deployed rather than null","Validate tenant configuration before building the migration command"],"exampleFix":"// before\nnew HistoricCaseInstanceMigrationCmd(\"myCase\", 2, null, doc, config);\n// after\nnew HistoricCaseInstanceMigrationCmd(\"myCase\", 2, \"myTenant\", doc, config);","handlingStrategy":"validation","validationCode":"if (tenantId == null) throw new IllegalArgumentException(\"caseDefinitionTenantId is required for historic case migration\");","typeGuard":null,"tryCatchPattern":"try { new HistoricCaseInstanceMigrationCmd(key, version, tenantId, doc, config); } catch (FlowableException e) { log.error(\"Missing tenant id for migration: {}\", e.getMessage()); }","preventionTips":["Resolve tenant id from the deployment metadata rather than optional request data","Default multi-tenant config explicitly (fail fast if absent)","Document tenant-id requirements in migration runbooks"],"tags":["flowable","cmmn","null-argument","multi-tenancy"],"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"}