Error 500 - unable to read contents from stream

Using keycloak 21.1.1

I have 4 realms that I import users to using the “/partialImport” api endpoint, using the same python script for each realm.

3 out of 4 realm import jobs works flawlessly, but the last one is always failing with 500 Error “unable to read contents from stream” when running the python script on this realm.

If I export the json to a file and then use postman to post this to the “/partialImport” api endpoint, it works no problem.

Does anyone know what could be the cause of this?

Hard to tell without the script and knowing exactly how you’re running things.

However, you’re much more likely to get help on the current version of Keycloak. And if you’re running 21, you should definitely upgrade, as you’re vulnerable to many CVEs.