Keycloak initial token error

I’m integrating Keycloak version 24.0.2 into my frontend. When attempting to log in, the frontend initially fails to retrieve the token, but succeeds in subsequent attempts. Upon checking the logs, I noticed warnings like the following:
image

2024-04-23 07:03:38,735 WARN [org.keycloak.events] (executor-thread-379) type="LOGIN_ERROR", realmId="158fxxxx-xxxx-xxxx-xxxx-597xxxx6xxxx", clientId="test", userId="null", ipAddress="172.xx.xx.xx", error="invalid_redirect_uri", redirect_uri="http://localhost:xxx/cxxxr"

I’m curious about the reason behind this behavior. It seems to work fine when integrated with other services. Any insights into why this issue might occur?