{"record":{"id":"c224c04c29e298d7","repo":"flowable/flowable-engine","slug":"caseinstanceid-is-null-c224c0","errorCode":null,"errorMessage":"caseInstanceId is null","messagePattern":"caseInstanceId is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseInstanceCmd.java","lineNumber":52,"sourceCode":"    private static final long serialVersionUID = 1L;\n\n    protected String caseInstanceId;\n    protected String userId;\n    protected String groupId;\n    protected String type;\n\n    public DeleteIdentityLinkForCaseInstanceCmd(String caseInstanceId, String userId, String groupId, String type) {\n        \n        validateParams(userId, groupId, caseInstanceId, type);\n        this.caseInstanceId = caseInstanceId;\n        this.userId = userId;\n        this.groupId = groupId;\n        this.type = type;\n    }\n\n    protected void validateParams(String userId, String groupId, String caseInstanceId, String type) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"caseInstanceId is null\");\n        }\n\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"type is required when deleting a process identity link\");\n        }\n\n        if (userId == null && groupId == null) {\n            throw new FlowableIllegalArgumentException(\"userId and groupId cannot both be null\");\n        }\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        CaseInstance caseInstance = cmmnEngineConfiguration.getCaseInstanceEntityManager().findById(caseInstanceId);\n\n        if (caseInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find case instance with id \" + caseInstanceId, CaseInstanceEntity.class);","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseInstanceCmd.java#L34-L70","documentation":"DeleteIdentityLinkForCaseInstanceCmd.validateParams throws FlowableIllegalArgumentException when caseInstanceId is null. Identity links on a case instance (e.g. participants) can only be removed for an identified case instance.","triggerScenarios":"Calling CmmnRuntimeService.deleteUserIdentityLink/deleteGroupIdentityLink with a null caseInstanceId, typically from an unpopulated variable.","commonSituations":"Event-driven code where the case instance id is extracted from context that is absent (e.g. outside a case execution); forms submitted without the instance reference.","solutions":["Pass the actual running case instance id, obtained from createCaseInstanceQuery() or the case execution context.","Null-check the id at the call site before invoking the runtime service."],"exampleFix":"// before\nruntimeService.deleteUserIdentityLink(caseInstanceId, userId, IdentityLinkType.PARTICIPANT);\n// after\nif (caseInstanceId == null) throw new IllegalArgumentException(\"caseInstanceId required\");\nruntimeService.deleteUserIdentityLink(caseInstanceId, userId, IdentityLinkType.PARTICIPANT);","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(caseInstanceId, \"caseInstanceId is required\");","typeGuard":"boolean hasInstanceId(String id) { return id != null && !id.trim().isEmpty(); }","tryCatchPattern":"try { runtimeService.deleteUserIdentityLink(caseInstanceId, userId, type); } catch (FlowableIllegalArgumentException e) { log.error(\"Invalid case identity-link delete: {}\", e.getMessage()); }","preventionTips":["Carry the caseInstanceId through context explicitly rather than reading nullable ambient state.","Validate at API boundaries before invoking runtime service calls."],"tags":["cmmn","identity-link","null-argument","java"],"backgroundTag":"null-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"}