{"record":{"id":"e8e57315a8205fbe","repo":"flowable/flowable-engine","slug":"no-case-instance-found-for-id","errorCode":null,"errorMessage":"No case instance found for id = '","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/CaseInstanceClaimCmd.java","lineNumber":54,"sourceCode":"\n    private final String caseInstanceId;\n    private final String userId;\n\n    public CaseInstanceClaimCmd(String caseInstanceId, String userId) {\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.userId = userId;\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        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        if (userId != null) {\n            List<IdentityLinkEntity> identityLinks = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration()\n                    .getIdentityLinkService().findIdentityLinksByScopeIdAndType(caseInstanceId, ScopeTypes.CMMN);\n            for (IdentityLinkEntity identityLink : identityLinks) {\n                if (IdentityLinkType.ASSIGNEE.equals(identityLink.getType())) {\n                    throw new FlowableException(\"Case instance '\" + caseInstanceId + \"' is already claimed.\");\n                }\n            }\n\n            IdentityLinkUtil.createCaseInstanceIdentityLink(caseInstanceEntity, userId, null, IdentityLinkType.ASSIGNEE, cmmnEngineConfiguration);\n\n            caseInstanceEntityManager.updateCaseInstanceClaimTime(caseInstanceEntity, cmmnEngineConfiguration.getClock().getCurrentTime(), userId);\n\n            if (cmmnEngineConfiguration.getCaseInstanceStateInterceptor() != null) {\n                cmmnEngineConfiguration.getCaseInstanceStateInterceptor().handleClaim(caseInstanceEntity, userId);","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CaseInstanceClaimCmd.java#L36-L72","documentation":"CaseInstanceClaimCmd.execute throws FlowableObjectNotFoundException when no case instance exists for the given id. The lookup via CaseInstanceEntityManager.findById returns null and the command reports the id with the expected entity type before any claim/identity-link changes are made.","triggerScenarios":"Claiming a case instance whose id does not exist, was completed/terminated, was deleted, or contains typos/whitespace; also using a case definition id or task id instead of a case instance id.","commonSituations":"Stale UI references after the case was closed by another user; ids from another Flowable deployment/database (wrong datasource config); copying ids between test and production environments.","solutions":["Verify the id via cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult() before claiming","Correct the id source — confirm it is a running case instance id","Catch FlowableObjectNotFoundException and map it to a 404-style response for external callers"],"exampleFix":"// before\ncmmnRuntimeService.claimCaseInstance(id, userId);\n// after\nCaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult();\nif (ci == null) {\n    throw new NotFoundException(\"Case instance not found: \" + id);\n}\ncmmnRuntimeService.claimCaseInstance(id, userId);","handlingStrategy":"validation","validationCode":"boolean exists = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    cmmnRuntimeService.claimCaseInstance(caseId, userId);\n} catch (FlowableObjectNotFoundException e) {\n    throw new NotFoundException(\"Case instance \" + caseId + \" not found\");\n}","preventionTips":["Refresh UI state before claim actions on long-lived pages","Confirm datasource/configuration points at the same environment the id came from","Map FlowableObjectNotFoundException to 404 responses in your API layer"],"tags":["flowable","cmmn","claim","not-found"],"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-14T11:17:12.474Z"}