Skip to content

Server errors

Luka Ilić edited this page Oct 25, 2023 · 17 revisions

The MobileMessaging SDK provides MobileMessagingError representation for the server error data. The following example demonstrates how an error code and message attributes may be retrieved from the error object:

val user = User()
user.phones = HashSet(listOf("_&*70318xxxxx3"))
MobileMessaging.getInstance(this).saveUser(user, object:MobileMessaging.ResultListener<User>() {
    override fun onResult(result: Result<User, MobileMessagingError>) {
        if (result.isSuccess) {
            // user saved
        } else {
            Log.e(TAG, result.error.code) // should print "PHONE_INVALID"
            Log.e(TAG, result.error.message) // should print "Invalid phone number: _&*70318xxxxx3"
        }
    }
})
expand to see Java code

User user = new User();
user.setPhones(new HashSet<>(Arrays.asList("_&*70318xxxxx3"));
MobileMessaging.getInstance(this).saveUser(user, new MobileMessaging.ResultListener<User>() {
    @Override
    public void onResult(Result<User, MobileMessagingError> result) {

    	if (result.isSuccess()) {
    		// user saved
    	} else {
	        Log.e(TAG, result.getError().getCode()); // should print "PHONE_INVALID"
	        Log.e(TAG, result.getError().getMessage()); // should print "Invalid phone number: _&*70318xxxxx3"
	    }
    }
});

New user/installation data APIs, starting from Mobile Messaging 2.0.0

Error code Error message Explanations
EMAIL_INVALID "Invalid email: {email}" Emails should have valid format (https://tools.ietf.org/html/rfc2822)
PHONE_INVALID Invalid phone number: {number} ({details}) Phone number should have valid format (https://en.wikipedia.org/wiki/E.164)
USER_IDENTITY_INVALID UserIdentity does not have any identity field set UserIdentity must have at least one field (phone/email/externalUserId) set, the SDK takes care of it by providing failable initializer for you
USER_MERGE_INTERRUPTED User update violates unique key constraint This error may happen when you try to saveUser with a unique attribute that refers to another Person record on the server
PERSONALIZATION_IMPOSSIBLE Installation is not depersonalized. Personalization is prohibited This error happens when you try to re-personalize current installation using UserIdentity that currently identifies another person. In such cases, you need to depersonalize first. To make both operations (depersonalize and personalize again) at once, use MobileMessaging.personalize(forceDepersonalize: true, ...) API
AMBIGUOUS_PERSONALIZE_CANDIDATES Several users satisfy supplied user identity This error happens when you try to personalize current installation with a UserIdentity matching several existing persons. This operation cannot be done by design. We recommend either to use only one field for personalization as a best practice, or to pay very close attention to what you personalize your installations with - keep it consistent and unique
USER_DATA_RESTRICTED User update access is restricted This error happens when you use `saveUser', but you have set up "Restrict saving sensitive data from SDK" for the application profile in your Infobip account.
REQUEST_FORMAT_INVALID {Field name} should be {supported type} Predefined user/installation data attribute has the wrong type. The SDK takes care of types for predefined user/installation attributes for you
APP_CODE_MISSING Application code not provided Application code is a mandatory parameter for all server requests
NO_REGISTRATION Registration does not exist In most cases the error means that the current push registration was expired and is no longer valid. We detect when the FCM token becomes invalid and we expire the push registration accordingly
ACCESS_TOKEN_MISSING Access token not provided This error means that the server API requires an access token to authenticate an actual application user. Might happen when fetching Inbox messages (learn more about token-based authorization)
UNAUTHORIZED Invalid login details The error means that the authorization data provided by the SDK is invalid. It means that an Application Code that you use to start the MM SDK might be wrong or deleted from the Infobip account; or an Access Token that you generated and provided has an invalid payload, signed with a wrong secret key, or the Token has expired (learn more about token-based authorization)
PERSON_DELETED Person for provided registration was deleted This error occurs when an installation is personalized with a person profile, and that particular person profile is deleted either via an API (single or batch), or through the People -> Persons section in your Infobip account

Other APIs (seen, messages sync, message sending, geo event reporting)

Error code Error message Explanations
0 Something went wrong [10000] This is really unknown, and most likely we are already working to fix things
1 Invalid Application Id [10001] The application code you've provided to the SDK doesn't exists
2, 4, 7, 8, 10, 11, 12, 13 Internal service error [xxxxx] There is nothing you can do with these errors, except retrying later. Most likely we're already fixing stuff, but you are always welcome to ask for support at push.support@infobip.com
Clone this wiki locally