{"record":{"id":"950f657c5b249ff5","repo":"flowable/flowable-engine","slug":"no-historic-case-instance-id-provided","errorCode":null,"errorMessage":"No historic case instance id provided","messagePattern":"No historic case instance id provided","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ReactivateHistoricCaseInstanceCmd.java","lineNumber":61,"sourceCode":"/**\n * This command reactivates a history case instance by putting it back to the runtime and triggering the reactivation event on its CMMN model. If there is no\n * reactivation event explicitly available, an exception is thrown.\n *\n * @author Micha Kiener\n */\npublic class ReactivateHistoricCaseInstanceCmd implements Command<CaseInstance>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected final CaseReactivationBuilderImpl reactivationBuilder;\n\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);","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ReactivateHistoricCaseInstanceCmd.java#L43-L79","documentation":"ReactivateHistoricCaseInstanceCmd reactivates a finished (historic) case instance back into the runtime. It first validates that the reactivation builder carries a case instance id; if reactivationBuilder.getCaseInstanceId() is null it throws FlowableIllegalArgumentException 'No historic case instance id provided'.","triggerScenarios":"Calling cmmnRuntimeService.createCaseInstanceReactivationBuilder() and then .reactivate() without ever calling .caseInstanceId(historicId) — e.g. the id variable was null because the historic lookup returned nothing earlier.","commonSituations":"Builders where the chain skipped the mandatory caseInstanceId(...) call; a null id propagated from a UI/form field; reactivating by key/version assumptions that don't exist in this API.","solutions":["Call .caseInstanceId(historicCaseInstanceId) on the reactivation builder before .reactivate()","Fetch the historic id first via cmmnHistoryService.createHistoricCaseInstanceQuery() and null-check it","Guard the builder input in application code before invoking reactivate()"],"exampleFix":"// before\ncmmnRuntimeService.createCaseInstanceReactivationBuilder().setReactivationListener(...).reactivate();\n// after\ncmmnRuntimeService.createCaseInstanceReactivationBuilder()\n    .caseInstanceId(historicCaseInstanceId)\n    .setReactivationListener(...)\n    .reactivate();","handlingStrategy":"validation","validationCode":"if (historicCaseInstanceId == null || historicCaseInstanceId.isEmpty()) throw new IllegalArgumentException(\"Historic case instance id is required for reactivation\");","typeGuard":null,"tryCatchPattern":"try { reactivationBuilder.caseInstanceId(id).reactivate(); } catch (FlowableIllegalArgumentException e) { log.error(\"Reactivation misconfigured: {}\", e.getMessage()); }","preventionTips":["Chain builder calls fluently so caseInstanceId() cannot be skipped","Obtain the historic id from cmmnHistoryService queries, not user input","Unit-test the reactivation flow with a real finished case instance"],"tags":["flowable","cmmn","null-argument","case-reactivation"],"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-18T11:17:12.947Z"}