Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-3109

POST realm API returns 400 on conflict instead of 409 in version 26.2.4 [GHI#39753]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [x] 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

      admin/api

      Describe the bug

      In the latest release of Keycloak, 26.2.4, the POST /admin/realms API now returns a 400 status code if the realm already exists instead of the 409 status code returned previously.

      This is the full response:

      400: b'{"errorMessage":"Realm <name> already exists"}'
      

      This API changes breaks a number of keycloak clients that expect a 409 status code to be returned when a realm already exists.

      Version

      26.2.4

      Regression

      [x] The issue is a regression

      Expected behavior

      If the realm already exists, the API should return a 409 status code.

      Actual behavior

      The API returns a 400 status code when the realm exists.

      How to Reproduce?

      Call the POST /admin/realms API with the name of a realm that already exists, and the response status code will be 400 instead of 409.

      Anything else?

      No response

      Example in postman:

      <img width="1397" alt="Image" src="https://github.com/user-attachments/assets/56879c51-a4ff-4616-b773-a28157cf41be" />

              Unassigned Unassigned
              pvlha Pavel Vlha
              Keycloak Core IAM
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: