{"record":{"id":"350c7fe6e9b36c73","repo":"flowable/flowable-engine","slug":"no-case-instance-found-for-id-caseinstanceid-350c7f","errorCode":null,"errorMessage":"No case instance found for id = '${caseInstanceId}'.","messagePattern":"No case instance found for id = '(.+?)'\\.","errorType":"validation","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetCaseInstanceDueDateCmd.java","lineNumber":48,"sourceCode":"\n    private final String caseInstanceId;\n    private final Date dueDate;\n\n    public SetCaseInstanceDueDateCmd(String caseInstanceId, Date dueDate) {\n        if (caseInstanceId == null || caseInstanceId.length() < 1) {\n            throw new FlowableIllegalArgumentException(\"The case instance id is mandatory, but '\" + caseInstanceId + \"' has not been provided.\");\n        }\n\n        this.caseInstanceId = caseInstanceId;\n        this.dueDate = dueDate;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CaseInstanceEntityManager caseInstanceEntityManager = CommandContextUtil.getCaseInstanceEntityManager(commandContext);\n        CaseInstanceEntity caseInstanceEntity = caseInstanceEntityManager.findById(caseInstanceId);\n        if (caseInstanceEntity == null) {\n            throw new FlowableObjectNotFoundException(\"No case instance found for id = '\" + caseInstanceId + \"'.\", CaseInstance.class);\n        }\n\n        caseInstanceEntityManager.updateCaseInstanceDueDate(caseInstanceEntity, dueDate);\n\n        return null;\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":56,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetCaseInstanceDueDateCmd.java#L30-L56","documentation":"Thrown by SetCaseInstanceDueDateCmd.execute when the case instance id passed validation but no CaseInstanceEntity exists for it. The command uses caseInstanceEntityManager.findById and throws FlowableObjectNotFoundException (with CaseInstance.class) when the lookup returns null, aborting the due date update.","triggerScenarios":"Calling CmmnRuntimeService.setCaseInstanceDueDate(id, dueDate) with a well-formed but unknown case instance id.","commonSituations":"Stale id after case instance termination/removal; id belonging to a BPMN engine instead of CMMN; multi-tenant or environment mismatch pointing at a different database.","solutions":["Confirm existence via cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id) before updating","Check the id is a CMMN case instance id, not a process instance or task id","Verify the engine points at the intended database/schema","Catch FlowableObjectNotFoundException and map it to a not-found response"],"exampleFix":"// before\ncmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate);\n// after\nCaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();\nif (ci != null) {\n    cmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate);\n}","handlingStrategy":"try-catch","validationCode":"CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();\nif (ci == null) { throw new NotFoundException(\"Case instance not found: \" + caseInstanceId); }","typeGuard":null,"tryCatchPattern":"try {\n    cmmnRuntimeService.setCaseInstanceDueDate(caseInstanceId, dueDate);\n} catch (FlowableObjectNotFoundException e) {\n    logger.warn(\"Case instance {} not found\", caseInstanceId);\n    throw new NotFoundException(e.getMessage(), e);\n}","preventionTips":["Check existence before mutating; ids can become stale between calls","Confirm the engine's datasource matches where the case was created","Handle case-instance completion races in async flows"],"tags":["flowable","cmmn","not-found","case-instance"],"backgroundTag":"entity-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}