Realm can be seen in admin UI, but cannot be found by 'kc.sh export'

Hi,

I have a Keycloak 24.0.2 instance running in a k8s environment. In addition to the ‘master’ realm, it contains another realm named ‘gene’ (this is what is shown in front of “Realm ID” in the page of the Admin console at URL .../admin/master/console/#/gene/realm-settings/general).

I want to export the users of this realm with their password hashes. (Because I manage the realm under Git as a JSON file, which I import at Keycloak start-up. I just added a user+password in the Admin UI and I want to copy it, with its hash, in the Git-managed JSON file. I know no other way of getting the hash of a password, but if there is one, I’m happy to learn about it.)

So I log into the k8s pod that corresponds to my Keycloak instance. The following lines confirm the existence of the ‘gene’ realm (which I can see in the Admin UI anyway):

$ bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user *** --password ***
Logging into http://localhost:8080 as user *** of realm master
$ bin/kcadm.sh get realms --fields id,realm
[ {
  "id" : "gene",
  "realm" : "gene"
}, {
  "id" : "518b6e18-ab1d-41cd-ae10-9fe5eea18ece",
  "realm" : "master"
} ]

However, the export command fails to find the realm:

$ bin/kc.sh export --file /tmp/gene.json --realm gene --verbose
...
2024-11-27 18:21:42,858 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: keycloak-76bcd57669-v2lcb-46849, Site name: null
2024-11-27 18:21:43,001 INFO  [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (main) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2024-11-27 18:21:43,129 INFO  [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
2024-11-27 18:21:45,767 INFO  [org.keycloak.services] (main) KC-SERVICES0034: Export of realm 'gene' requested.
2024-11-27 18:21:45,768 INFO  [org.keycloak.exportimport.singlefile.SingleFileExportProvider] (main) Exporting realm 'gene' into file /tmp/gene.json
2024-11-27 18:21:45,908 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2024-11-27 18:21:45,966 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (import_export) mode
2024-11-27 18:21:45,966 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) Error details:: java.lang.NullPointerException: realm not found by realm name 'gene'
	at java.base/java.util.Objects.requireNonNull(Objects.java:235)
	at org.keycloak.exportimport.singlefile.SingleFileExportProvider$2.runExportImportTask(SingleFileExportProvider.java:90)
...

Any help appreciated!
Bruno