as there are only 64 characters in Base64 charset (A-Z,a-z,0-9,+,/) plus the pad char "=". it should be easy to determine the error:
https://en.wikipedia.org/wiki/Base64
the length of the unencoded byte array should be a multiple of 3, otherwise padding is required. each char encodes 6 bits.