Service Account Creation Fails Most Of The Time

I have recently upgraded my Grafana OSS stack to 9.5.1 and now I’m having issues with service account creation, when trying to create new service accounts via the UI. Most of the time, I get an error message saying “Failed to create service account” (screenshot 1). When I then try to create a new service account with the same name, I get a message saying “service account already exists” (screenshot 2). The service account is not visible in the Grafana UI.

Sometimes, maybe 1 in 10 attempts, service account creation is successful, but I’m not quite sure why. Any ideas why that might be happening and how to fix it?

FYI, the setup runs on Kubernetes and is configured for high availability with two replicas and a HA installation of PostgreSQL as the database.


Exactly the same on our side.

Tried different Grafana versions, lastly v10.0.2 (using latest Helm charts for Grafana and Postgres-ha backend).

We are also facing the issue. Not able to create service account after upgrading to 10.0.1.
Using mysql database.

Log says below during the first time when i try to create a service account
“failed to create service account: user not found”.
when I try to create again i get the “service account already exist” error with below log.
msg=“Request Completed” method=POST path=/api/serviceaccounts/ status=500

Is there any bug reported on this ? looks like a common issue when using postgres backend

I am able to workaround this by calling the api directly using curl

curl -X POST -H "Content-Type: application/json" -d '{"name":"test", "role": "Admin"}' https://username:password@localhost:3000/api/serviceaccounts

^ will create the account and return the id

curl -X POST -H "Content-Type: application/json" -d '{"name":"test-token"}' https://username:password@localhost:3000/api/serviceaccounts/< id >/tokens

^ will create and return the token