# Multiple results from IDP

**URL:** <https://forum.keycloak.org/t/multiple-results-from-idp/27811>\
**Category:** Getting advice\
**Created:** [September 10, 2024, 2:20pm UTC](https://forum.keycloak.org/t/multiple-results-from-idp/27811 "2024-09-10T14:20:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmtkac](https://avatars.discourse-cdn.com/v4/letter/v/c0e974/32.png) [@vmtkac](https://forum.keycloak.org/u/vmtkac)\
**Post date:** [September 10, 2024, 2:20pm UTC](https://forum.keycloak.org/t/multiple-results-from-idp/27811/1 "2024-09-10T14:20:53Z")

</div>

I am getting the below error. We are using a custom storage provider and had a couple of issues with this particular login so things may be in a weird state. I have cleaned up everything I could find about the user and the record I see from the UI is correct with the correct IDP and the correct linkage. That record is the very bottom one. The other two records listed do not exist when I try to look them up by ID. I also can’t find any other matches for the user via the UI.

Can anyone help point me at what else I might need to cleanup to get rid of these IDs?

Here is the error:

Sep 10 13:34:34 prod-keycloak kc.sh[1580904]: Caused by: java.lang.IllegalStateException: More results found for identityProvider=idp1, [userId=vince.tkac@company.com](mailto:userId=vince.tkac@company.com), results=[f:1293a9fe-0462-4892-9457-acbd7da51bfe:1725491736339, f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03b, f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03]

I look up each one via the CLI:

root@prod-keycloak:/opt/keycloak-23.0.4/bin# ./kcadm.sh get ‘realms/realm1/users/f:1293a9fe-0462-4892-9457-acbd7da51bfe:1725491736339’  
Resource not found for url: xxxxx://app.com/admin/realms/realm1/users/f:1293a9fe-0462-4892-9457-acbd7da51bfe:1725491736339

root@prod-keycloak:/opt/keycloak-23.0.4/bin# ./kcadm.sh get ‘realms/realm1/users/f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03b’  
Resource not found for url: xxxxx://app.com/admin/realms/realm1/users/f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03b

root@prod-keycloak:/opt/keycloak-23.0.4/bin# ./kcadm.sh get ‘realms/realm1/users/f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03’  
{  
“id” : “f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03”,

---

<div class="post-metadata">

**Author:** ![vmtkac](https://avatars.discourse-cdn.com/v4/letter/v/c0e974/32.png) [@vmtkac](https://forum.keycloak.org/u/vmtkac)\
**Post date:** [September 11, 2024, 10:08pm UTC](https://forum.keycloak.org/t/multiple-results-from-idp/27811/2 "2024-09-11T22:08:27Z")

</div>

I found this data in the broker\_linkage table by querying the DB directly.

```auto
public.broker_link
identity_provider, storage_provider_id, realm_id, broker_user_id, broker_username, token, user_id
idp1 1293a9fe-0462-4892-9457-acbd7da51bfe 0fe352f5-9351-4a6b-aaad-5f64179c7437 vince.tkac@company.com vince.tkac@company.com \N f:1293a9fe-0462-4892-9457-acbd7da51bfe:1725491736339
idp1 1293a9fe-0462-4892-9457-acbd7da51bfe 0fe352f5-9351-4a6b-aaad-5f64179c7437 vince.tkac@company.com vince.tkac@company.com \N f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03b
idp1 1293a9fe-0462-4892-9457-acbd7da51bfe 0fe352f5-9351-4a6b-aaad-5f64179c7437 vince.tkac@company.com vince.tkac@company.com \N f:1293a9fe-0462-4892-9457-acbd7da51bfe:940a7f1c-a7bd-4dfc-91a6-322551807d03

```

I can not find these via the admin UI. I think these are orphans from records that were removed from the external federated user table.

Is it safe to remove these directly from the DB? Would there be other data that also needs to be removed?
