Repository navigation
Open
Labels
area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concernsCore server — startup, configuration, providers/SPIs, cross-cutting concernsgood first issuekind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/lowteam/core-iamteam/core-shared
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
core
Describe the bug
We get exceptions in the logs
Version
26.3.2
Regression
- The issue is a regression
Expected behavior
no exception in the logs
Actual behavior
We got this exception:
2025-08-04 11:46:38,469 logLevel=ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-15) Uncaught server error: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "org.keycloak.representations.idm.CredentialRepresentation.getHashIterations()" is null
at org.keycloak.models.utils.RepresentationToModel.convertDeprecatedCredentialsFormat(RepresentationToModel.java:245)
at org.keycloak.models.utils.RepresentationToModel.createCredentials(RepresentationToModel.java:778)
at org.keycloak.services.resources.admin.UsersResource.createUser(UsersResource.java:173)
at org.keycloak.services.resources.admin.UsersResource$quarkusrestinvoker$createUser_dbaf1f3ce12d75e1e6e52c8055b800147ead4329.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:638)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1583)
How to Reproduce?
No sure about it
Anything else?
No response
Reacted by StManolo
Metadata
Metadata
Assignees
Labels
area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concernsCore server — startup, configuration, providers/SPIs, cross-cutting concernsgood first issuekind/bugCategorizes a PR related to a bugCategorizes a PR related to a bugpriority/lowteam/core-iamteam/core-shared
Type
Fields
No fields configured for bug.
Projects
- StatusShow more project fieldsNo status
Activity
sguilhen commentedon Aug 7, 2025
This was logged during a user creation. We would need more info one how the user is being created, specially the contents of the UserRepresentation (as JSON would be fine as well).
nowheresly commentedon Aug 7, 2025
As far as I know, most of our users are created using a social identity provider. So there's no credentials stored in keycloak.
rmartinc commentedon Aug 8, 2025
@nowheresly The stack-trace of the exception shows the user is being created through the admin API (sending some json via POST to endpoint
/admin/realms/{realm}/users). We need the json that is sent to that endpoint. It seems that the json representation of the user contains some data for the password and that data is throwing this exception.16 remaining items
Checking password and OTP are present and can be converted
rahul-chakradhari commentedon Feb 14, 2026
Hi @nowheresly,
I am an Outreachy applicant and a Java developer. I noticed the NullPointerException reported after the 26.3.2 migration. I have experience in debugging Java backend issues and would like to fix this.
Could you please assign this to me? I am ready to investigate the stack trace and submit a PR with the necessary null-safety checks. Thanks!
LouisLau-art commentedon Mar 3, 2026
I opened a fix PR for this issue: #46767
It adds a null-safety check for incomplete deprecated password credentials in
RepresentationToModeland returns a controlledModelExceptioninstead of a server-side NPE.Fix NPE in convertDeprecatedCredentialsFormat when credential fields …
nandinis4 commentedon Jul 18, 2026
Hi, I'd like to work on this.
I traced the NPE to
convertDeprecatedCredentialsFormat()inRepresentationToModel.java—CredentialRepresentation.getHashIterations()returns a nullableInteger, which auto-unboxes tointwhen passed to thePasswordCredentialDataconstructor, throwing NPE when the field is absent in the import payload.I also noticed the same pattern in the OTP path —
getDigits(),getCounter(), andgetPeriod()are all nullableIntegerpassed toOTPCredentialData's primitiveintparameters. I'll fix both in one PR.Proposed fix: null-safe extraction with sensible defaults —
-1forhashIterations(consistent with howPasswordCredentialProvideruses it as a "use provider default" sentinel), and standard TOTP/HOTP defaults for OTP fields (6 digits, 0 counter, 30s period).Will open a PR shortly.