Discord is a pain in the backside. Its sign-in experience can only be described as smashing your privates with a hammer. Often, you'll end up with multiple identities, one with an email, one with just a username, and only one of them actually works to sign you in, and possibly zero, because you may need the password from one of the username identities with the email address from the other one. :-(
If worst comes to worst, create a new Discord account with a different email address.
The code failure might be because you haven't verified your Discord account with a phone number (according to somebody who posted down below). Worth a try.