Probably bug with discourse since I’ve also experienced the same error on bitwarden forum. A workaround that works on bw forum is to disable 2fa, change email address, reenable 2fa again but that doesn’t work here. Even after disabling 2fa, the internal server error is still there.