diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/idevent/IdChangeEventHandlerServiceImpl.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/idevent/IdChangeEventHandlerServiceImpl.java index c91749d4ccd..4c7a6c58dbb 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/idevent/IdChangeEventHandlerServiceImpl.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/impl/idevent/IdChangeEventHandlerServiceImpl.java @@ -187,7 +187,7 @@ private void handleRemoveId(EventModel eventModel) throws IdAuthenticationBusine Event event = eventModel.getEvent(); Map additionalData = event.getData(); String idHash = (String) additionalData.get(ID_HASH); - if (idHash != null && !idHash.isEmpty()) { + if (idHash != null && !idHash.isEmpty() && identityCacheRepo.existsById(idHash)) { identityCacheRepo.deleteById(idHash); removeIdStatusEventPublisher.publishRemoveIdStatusEvent(idHash); }