{"record":{"id":"5f5e6c1d794e8af1","repo":"flowable/flowable-engine","slug":"the-historic-case-instance-caseinstanceid-cannot","errorCode":null,"errorMessage":"The historic case instance <caseInstanceId> cannot be reactivated as there is no reactivation event in its CMMN model. You need to explicitly model the reactivation event in order to support case reactivation.","messagePattern":"The historic case instance <caseInstanceId> cannot be reactivated as there is no reactivation event in its CMMN model\\. You need to explicitly model the reactivation event in order to support case reactivation\\.","errorType":"exception","errorClass":"FlowableIllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceHelperImpl.java","lineNumber":249,"sourceCode":"    /**\n     * This is the first part of reactivating a case instance from the history. It copies the historic data back to the runtime which is the case instance,\n     * its plan items and the variables. This method does not trigger the reactivation listener, just checks, if it is there, but there is no reactivation\n     * of plan items, etc. Just the copy of the historic data back to the runtime.\n     *\n     * @param commandContext the command context to execute within\n     * @param caseDefinition the case definition to get the case model from\n     * @param caseInstance the historic case instance to copy back to the runtime\n     * @return the copied runtime case instance entity for further processing\n     */\n    protected CaseInstanceEntity copyHistoricCaseInstanceToRuntime(CommandContext commandContext, CaseDefinition caseDefinition, HistoricCaseInstance caseInstance) {\n        CmmnModel cmmnModel = getCmmnModel(commandContext, caseDefinition);\n        Case caseModel = getCaseModel(caseDefinition, cmmnModel);\n\n        ReactivateEventListener listener = caseModel.getReactivateEventListener();\n        if (listener == null) {\n            // the reactivation event listener must be present in order to reactivate the case, there is no generic way as it is always business driven\n            // on what happens during reactivation\n            throw new FlowableIllegalStateException(\"The historic case instance \" + caseInstance.getId()\n                + \" cannot be reactivated as there is no reactivation event in its CMMN model. You need to explicitly model the reactivation event in order to support case reactivation.\");\n        }\n\n        // recreate the case instance in the runtime data table from the historic one\n        return createCaseInstanceEntityFromHistoricCaseInstance(commandContext, caseInstance);\n    }\n\n    protected void createAsyncInitJob(CaseInstanceEntity caseInstance, CaseDefinition caseDefinition, \n            Case caseModel, JobService jobService, CommandContext commandContext) {\n        \n        JobEntity job = JobUtil.createJob(caseInstance, caseModel, AsyncInitializePlanModelJobHandler.TYPE, cmmnEngineConfiguration);\n        job.setElementId(caseDefinition.getId());\n        job.setElementName(caseDefinition.getName());\n        job.setJobHandlerConfiguration(caseInstance.getId());\n        \n        jobService.createAsyncJob(job, false);\n        jobService.scheduleAsyncJob(job);\n    }","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceHelperImpl.java#L231-L267","documentation":"When reactivating a historic (completed/terminated) case instance, copyHistoricCaseInstanceToRuntime looks up the ReactivateEventListener in the case's CMMN model. Because reactivation behavior is always business-specific, Flowable refuses to guess: if the <case> element has no reactivation event listener modeled, it throws FlowableIllegalStateException instead of performing a default reactivation.","triggerScenarios":"Calling CmmnRuntimeService.createCaseInstanceBuilder().reactivate(historicCaseInstanceId).start() (or CaseService reactivation APIs) on a case whose CMMN XML <case> does not declare a reactivation event listener.","commonSituations":"Deployed case model predates the reactivation feature (models created for older Flowable versions lack the listener); a new version of the case definition was deployed without the reactivation event while old historic instances still need reactivation; developer assumes reactivation works out of the box.","solutions":["Add a reactivation event listener to the <case> element in the CMMN XML and redeploy the case definition.","Configure the listener's plan item / behavior to define the business-specific reactivation logic.","If reactivation is not required for this case, do not call the reactivation API; start a fresh case instance instead."],"exampleFix":"// before: case XML without reactivation support, then\nruntimeService.createCaseInstanceBuilder().reactivate(historicId).start(); // throws\n// after: add to the <case> element in the CMMN model, redeploy, then reactivate\n//   <extensionElements>\n//     <flowable:reactivateEventListener />\n//   </extensionElements>","handlingStrategy":"try-catch","validationCode":"CmmnModel model = cmmnRepositoryService.getCmmnModel(caseDefinitionId);\nCase caseModel = model.getMainProcess(); // Case element\nboolean canReactivate = caseModel != null && caseModel.getReactivateEventListener() != null;","typeGuard":null,"tryCatchPattern":"try {\n    return runtimeService.createCaseInstanceBuilder().reactivate(historicCaseInstanceId).start();\n} catch (FlowableIllegalStateException e) {\n    if (e.getMessage().contains(\"no reactivation event\")) {\n        // fall back to starting a new case instance or inform the user reactivation is unsupported\n    }\n    throw e;\n}","preventionTips":["Model a ReactivateEventListener in every <case> that must support reactivation.","Add a deploy-time check that inspects the CMMN model for the listener when reactivation is a requirement.","Re-check the listener after redeploying new versions of case definitions."],"tags":["cmmn","case-reactivation","missing-model-element","invalid-state"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}