keycloak/keycloak

Setting some attributes to multivalued causes 400 errors

Open

#42.749 aperta il 18 set 2025

Vedi su GitHub
 (2 commenti) (1 reazione) (0 assegnatari)Java (8346 fork)batch import
area/admin/apiarea/user-profilehelp wantedkind/bugpriority/normalstatus/auto-bumpteam/core-iamteam/core-shared

Metriche repository

Star
 (34.398 star)
Metriche merge PR
 (Merge medio 6g 19h) (384 PR mergiate in 30 g)

Descrizione

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

admin/api

Describe the bug

In trying to get Keycloak to send verification and account recovery emails to multiple addresses I turned on multivalued for the email attribute.

After doing this, adding emails to an account causes a 400 error:

{"error":"unknown_error","error_description":"Cannot parse the JSON"}

In the debug logs I also see the following:

kc.sh[99219]: 2025-09-18 18:43:28,738 DEBUG [org.jboss.resteasy.reactive.server.handlers.RequestDeserializeHandler] (executor-thread-4) Error occurred during deserialization of input: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`)
kc.sh[99219]:  at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 170] (through reference chain: org.keycloak.representations.idm.UserRepresentation["email"])

I assume this error means that somewhere the value for email is hardcoded as the type String.

Version

26.3.4

Regression

  • The issue is a regression

Expected behavior

Either the multivalued toggle is not present for attributes where it isn't supported, and/or functionality is expended to support multiple email addresses.

Actual behavior

Enabled multivalued for certain attributes causes an error.

How to Reproduce?

Enabled multivalued for email, or username, and try updating those fields in user info.

Anything else?

No response

Guida contributor