{"record":{"id":"14b70b68f8c16a24","repo":"flowable/flowable-engine","slug":"no-historic-case-instance-to-be-reactivated-found","errorCode":null,"errorMessage":"No historic case instance to be reactivated found with id: ","messagePattern":"No historic case instance to be reactivated found with id: ","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ReactivateHistoricCaseInstanceCmd.java","lineNumber":71,"sourceCode":"\n    public ReactivateHistoricCaseInstanceCmd(CaseReactivationBuilderImpl reactivationBuilder) {\n        this.reactivationBuilder = reactivationBuilder;\n    }\n\n    @Override\n    public CaseInstance execute(CommandContext commandContext) {\n        if (reactivationBuilder.getCaseInstanceId() == null) {\n            throw new FlowableIllegalArgumentException(\"No historic case instance id provided\");\n        }\n\n        // Check if the historic case instance is found and if it is no longer running\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        HistoricCaseInstance instance = cmmnEngineConfiguration.getHistoricCaseInstanceEntityManager().createHistoricCaseInstanceQuery()\n            .caseInstanceId(reactivationBuilder.getCaseInstanceId())\n            .singleResult();\n\n        if (instance == null) {\n            throw new FlowableObjectNotFoundException(\"No historic case instance to be reactivated found with id: \" + reactivationBuilder.getCaseInstanceId(), HistoricCaseInstance.class);\n        }\n        if (instance.getEndTime() == null) {\n            throw new FlowableIllegalStateException(\"Case instance is still running, cannot reactivate historic case instance: \" + reactivationBuilder.getCaseInstanceId());\n        }\n\n        // move the case instance back to the runtime (this also checks, if the reactivation listener is even existent)\n        CaseInstanceEntity caseInstanceEntity = cmmnEngineConfiguration.getCaseInstanceHelper()\n            .copyHistoricCaseInstanceToRuntime(instance);\n\n        // reset the state to be active again and also set the last reactivation time as well as the current user triggering it\n        caseInstanceEntity.setState(CaseInstanceState.ACTIVE);\n        caseInstanceEntity.setLastReactivationTime(cmmnEngineConfiguration.getClock().getCurrentTime());\n        caseInstanceEntity.setLastReactivationUserId(Authentication.getAuthenticatedUserId());\n\n        // set case variables, if the builder contains any\n        if (reactivationBuilder.hasVariables()) {\n            caseInstanceEntity.setVariables(reactivationBuilder.getVariables());\n        }","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/ReactivateHistoricCaseInstanceCmd.java#L53-L89","documentation":"After validating the id, ReactivateHistoricCaseInstanceCmd queries the historic case instance store. If no historic case instance matches the given id it throws FlowableObjectNotFoundException 'No historic case instance to be reactivated found with id: <id>' with HistoricCaseInstance.class, meaning there is no completed case instance history record under that id to reactivate.","triggerScenarios":"Calling reactivate() with an id of a still-running (non-historic) case instance, a never-existing id, or an id from a system where CMMN history was purged or never recorded (history level too low).","commonSituations":"Id of a running case instance passed instead of the historic one; history cleanup job deleted the record; history level configured below audit so no historic instance was persisted; ids from another environment/database.","solutions":["Confirm the historic record exists: cmmnHistoryService.createHistoricCaseInstanceQuery().caseInstanceId(id).singleResult() != null and finished == true","If the case is still running, don't reactivate — operate on the runtime instance instead","Enable/raise the CMMN history level (e.g. audit) so finished cases are persisted, and check history cleanup settings","Catch FlowableObjectNotFoundException to handle missing historic instances gracefully"],"exampleFix":"// before\ncmmnRuntimeService.createCaseInstanceReactivationBuilder().caseInstanceId(runningCaseId)... // not in history\n// after\nHistoricCaseInstance h = cmmnHistoryService.createHistoricCaseInstanceQuery().caseInstanceId(id).finished().singleResult();\nif (h != null) { cmmnRuntimeService.createCaseInstanceReactivationBuilder().caseInstanceId(h.getId())... }","handlingStrategy":"validation","validationCode":"HistoricCaseInstance h = cmmnHistoryService.createHistoricCaseInstanceQuery().caseInstanceId(id).finished().singleResult();\nif (h == null) throw new IllegalArgumentException(\"No finished historic case instance with id \" + id);","typeGuard":null,"tryCatchPattern":"try { reactivationBuilder.caseInstanceId(id).reactivate(); } catch (FlowableObjectNotFoundException e) { log.warn(\"Historic case instance {} not found\", id); }","preventionTips":["Only reactivate ids confirmed via HistoricCaseInstanceQuery with finished() filter","Keep history level at audit or higher so completed cases are persisted","Account for history cleanup jobs when reactivating old instances"],"tags":["flowable","cmmn","entity-not-found","case-reactivation","history"],"backgroundTag":"record-not-found","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"}