SQL Error with `screened_ip_addresses` (API throws 500)

I don’t think anything is wrong with your db because the error is checking if there is a blank ip address in the screened ip address table not that there is empty ip addresses in your db.

The interesting thing though is that this code is checking for the existence of an ip_address before making that sql request that is throwing the 500.

Can you describe how your Discourse instance is setup? Is it from an import? Are you on the latest version? How much ram does it have? Did you follow this guide?

Can you check this site setting: max new accounts per registration ip? I’m not sure it matters in this case but perhaps it is causing an issue.

In your bulk script could you slow it down and have a 1 sec pause between requests and see if that makes a difference?

What is the purpose of these api calls? If it is a one time script to build import users and posts then perhaps an import script that runs on the actual server that doesn’t make api calls would be better?

Sorry for all the questions, but we haven’t run into this issue before and the code around screened_ip_addresses hasn’t been updated in a long while. I’m not saying we don’t have a bug in the code base somewhere, but after having a quick look nothing is standing out at the moment.