-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Closed
Copy link
Labels
area/organizationskind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/importantMust be worked on very soonMust be worked on very soonrelease/26.3.0team/core-iam
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
organizations
Describe the bug
Discovered via admin api via PUT /admin/realms/{realm}/organizations/{org-id}
, but also shows in admin ui:
When creating a new organization with a name that already exists an appropriate error with http status 409
is returned
{
"errorMessage": "A organization with the same name already exists."
}
When updating an organization, changing the name to one that already exists, a generic error with http status 500
is returned
{
"error": "unknown_error",
"error_description": "For more on this error consult the server log."
}
and server logs show an unhandled exception:
2025-04-24 09:59:22,709 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-417) Uncaught server error: org.hibernate.exception.ConstraintViolationException: could not execute batch [Batch entry 0 update public.ORG set ALIAS=('testorg123'),DESCRIPTION=(''),ENABLED=('TRUE'::boolean),GROUP_ID=('e230bf45-dae9-484a-9d99-d2d5dff77e20'),NAME=('123 123'),REALM_ID=('testrealm'),REDIRECT_URL=(NULL) where ID=('62096c46-64ae-4e1d-95e6-d3c4fb3b57c0') was aborted: ERROR: duplicate key value violates unique constraint "uk_org_name"
Version
26.2.1
Regression
- The issue is a regression
Expected behavior
When updating an organization with PUT /admin/realms/{realm}/organizations/{org-id}
, using a name that already exists, an appropriate error and status code that is consistent with a similar situation while creating an organization is returned.
Actual behavior
Updating returns a generic error while creating returns a specific error.
How to Reproduce?
- create 2 organizations
- try to update one organization using the name of the other
- observe error messages and server log
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area/organizationskind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/importantMust be worked on very soonMust be worked on very soonrelease/26.3.0team/core-iam