# Handling Duplicate Email Error During User Registration in Keycloak Custom Page

**URL:** https://forum.keycloak.org/t/handling-duplicate-email-error-during-user-registration-in-keycloak-custom-page/29163
**Category:** Getting advice
**Created:** [December 11, 2024, 6:25am UTC](https://forum.keycloak.org/t/handling-duplicate-email-error-during-user-registration-in-keycloak-custom-page/29163 "2024-12-11T06:25:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![karim-lmchi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/karim-lmchi/32/11768_2.png) [@karim-lmchi](https://forum.keycloak.org/u/karim-lmchi)
#### Post date: [December 11, 2024, 6:25am UTC](https://forum.keycloak.org/t/handling-duplicate-email-error-during-user-registration-in-keycloak-custom-page/29163/1 "2024-12-11T06:25:32Z")

</div>

I have a Keycloakify project where I am customizing my Keycloak login page.  
I would like to inform a new user during registration if an account with their email address already exists.  
How can I achieve this?

Currently, my registration page works well, but when I click the “doRegister” button and their account already exists, I am redirected to the previous step of the registration process with the following error:  
`2024-12-09 15:58:21,852 WARN [org.keycloak.events] (executor-thread-18420) type=REGISTER_ERROR, realmId=bc45ac45-69aa-4bfb-a31d-8b4ecaeafe3e, clientId=muse-oidc, userId=null, ipAddress=10.212.132.4, error=email_in_use, auth_method=openid-connect, auth_type=code, register_method=form, last_name=doe, redirect_uri=https://muse-test.mnhn.fr/api/auth/callback/keycloak, first_name=John, code_id=69b2930f-9969-410d-b404-6529cf4cc0e6, email=test@email.com, [username=test.@email.com](mailto:username=test@email.com)`

How can I catch this error and use it to display an error message on my form while the user is entering their information?

Is there a simpler solution provided by Keycloak to handle this issue?

I also tried using `keycloak-admin-client`, but I get a CORS error because I am using a different backend for my application once logged in.

For reference:

```auto
keycloakify: "ˆ9.5.8"
@keycloak/keycloak-admin-client: "ˆ26.0.7"

```
