The 500 code would normally indicate an error on the server, not anything with your code. Some thoughts
Talk to the server developer for more info. You can’t get more info directly.
Verify your arguments into the call (values). Look for anything you might think could cause a problem for the server process. The process should not die and should return you a better code, but bugs happen there also.
Could be intermittent, like if the server database goes down. May be worth trying at another time.