# UserStorageProvider - Can't create user using the admin UI as provider gets invoked trying to migrate the new user

**URL:** <https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782>\
**Category:** Extending the server\
**Created:** [May 31, 2022, 5:03am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782 "2022-05-31T05:03:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronny](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@ronny](https://forum.keycloak.org/u/ronny)\
**Post date:** [May 31, 2022, 5:03am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782/1 "2022-05-31T05:03:39Z")

</div>

Dear all,

I have implemented an own `UserStorageProvider` in Keycloak 18.0 which migrates users from our legacy system to Keycloak on first login attempt against Keycloak. This works fine so far.

Now I have tried to add a user manually using the admin UI of Keycloak but without success.

Every time I hit the ‘Save’ / ‘Create’ button, the custom `UserStorageProvider` gets invoked trying to search for that user in our legacy system - which at least results in an error due to the fact that the user does not exist in the legacy system. Which makes sense because I only want the user to be created locally in Keycloak.

The workaround for this is to disable my custom `UserStorageProvider`, create the desired user over the admin UI and enable the custom `UserStorageProvider`again. This won’t invoke the `UserStorageProvider` due to the fact that it’s disabled.

Now, in my opinion, this is not how it should be.  
Can somebody imagine what I am doing wrong here?

---

<div class="post-metadata">

**Author:** ![ronny](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@ronny](https://forum.keycloak.org/u/ronny)\
**Post date:** [August 30, 2022, 7:23am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782/2 "2022-08-30T07:23:27Z")

</div>

No ideas here? I am still facing this issue

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [August 30, 2022, 9:16am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782/3 "2022-08-30T09:16:07Z")

</div>

Probably you want to implement also the `org.keycloak.storage.user.UserRegistrationProvider` interface in your custom `UserStorageProvider` implementation.

Just return `null` from the `addUser()` method and `false` from `removeUser()`.

---

<div class="post-metadata">

**Author:** ![ronny](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@ronny](https://forum.keycloak.org/u/ronny)\
**Post date:** [August 31, 2022, 6:59am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782/4 "2022-08-31T06:59:26Z")

</div>

Thanks, I’ll give it a try

---

<div class="post-metadata">

**Author:** ![ronny](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@ronny](https://forum.keycloak.org/u/ronny)\
**Post date:** [September 1, 2022, 7:24am UTC](https://forum.keycloak.org/t/userstorageprovider-cant-create-user-using-the-admin-ui-as-provider-gets-invoked-trying-to-migrate-the-new-user/15782/5 "2022-09-01T07:24:46Z")

</div>

Sorry - makes no difference at all.
