I think it is likely the error is not on the Bitcoin side it is rather on the mempool. To be sure, try to add the debug configurations on my post above, I believe it will give clarity why the mempool is returning HTTP 500 since it will log more output on both electrs and mempool.