Thanks. This helped solve my issue. Today I learned that there is regular base64 and URL-safe base64. This answer on StackOverflow details the differences between the two nicely: https://stackoverflow.com/a/55389212
I originally passed a URL-safe base64 string into createCredentialRegistrationRequestWithChallenge, which caused this error to occur. After converting it into regular base64, the issue was resolved.