raise exception if the key cannot be decoded properly