Session lost reference to the client

After user authenticated and created a session, after token expired and client use the refresh token, user receive this message:

{
    "error": "invalid_grant",
    "error_description": "Session doesn't have required client"
}

Looking at the user session tb, I can see this:

There’s two session that have no client.

What can cause this?

Keycloak: 15.1.1

Thank you

Hello community,

I can confirm the same issue on version 16.1.
@klinux did you found some workaround solution?
The issue happens “sometimes”.
If you have any suggestions that can be done, feel free to suggest, we are willing to test.

BR,
Jasmin

@jasminstrkonjic

I fixed at my side using this patch: keycloak-project-example/deployments/local/clusterx/haproxy-database-ispn at main · thomasdarimont/keycloak-project-example · GitHub

And recover session from database when needed.

Can you try this?