Repository navigation
Server errors
The Mobile Messaging SDK uses MobileMessagingError for both local SDK failures and server/API failures. This reference applies to the Android and Huawei SDKs; their current Inbox error codes described below are the same.
-
getCode()returns a string. Some codes are symbolic strings such as"NO_REGISTRATION"; others are numeric strings such as"20006". Neither should be confused with an HTTP status. -
InternalSdkErrorenum names describe local errors, but are not necessarily the strings returned bygetCode(). For example,InternalSdkError.NO_VALID_REGISTRATIONreturns"20006", not"NO_VALID_REGISTRATION". - The local checks listed below have
getType() == MobileMessagingError.Type.SDK_ERROR. API/transport failures useSERVER_ERROR; a transport failure does not necessarily have an HTTP response. -
getMessage()provides details about the failure. In SDK versions supporting HTTP-status metadata,getHttpStatusCode()provides the response status when available, independently ofgetCode(). It is null for local validation and failures without an HTTP response.
See local SDK errors used by Inbox, historical JWT codes, and the server/API error tables below.
The following example demonstrates how 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"
}
}
});These errors are produced locally, before an Inbox request is sent. They are not HTTP status codes and do not indicate a server response.
Exact string returned by getCode()
|
SDK enum name | Meaning and handling |
|---|---|---|
"20006" |
InternalSdkError.NO_VALID_REGISTRATION |
No valid local push registration is available. Initialize the SDK and wait for a server-issued push registration ID, then retry. This existing SDK readiness error is different from the backend's "NO_REGISTRATION" response. |
"20013" |
InternalSdkError.INBOX_INVALID_PARAMETERS |
Invalid Inbox input: a blank supplied token or external user ID; a null/empty deletion ID array or a blank ID; or a nonblank cursor combined with any nonempty topics list. Inspect getMessage() and correct the input. A blank supplied JWT does not fall back to Application Code authorization. |
The Inbox validation entry applies to the APIs documented for Android SDK 16.6.0 and Huawei SDK 9.5.0. "20006" predates these Inbox features. Local validation callbacks may run synchronously; no HTTP request is sent and getHttpStatusCode() is null.
Compare against "20006" and "20013" when inspecting getCode(), not against the enum names "NO_VALID_REGISTRATION" or "INBOX_INVALID_PARAMETERS".
Before Android 13.22.x / Huawei 7.11.x, JWT structure and expiration errors used "20013" and "20014", respectively. Those JWT checks now return "JWT_TOKEN_STRUCTURE_INVALID" and "JWT_TOKEN_EXPIRED". See the Android migration guide and Huawei migration guide.
The current Inbox APIs reuse "20013" for INBOX_INVALID_PARAMETERS. This does not reverse the JWT migration: current JWT structure failures still use "JWT_TOKEN_STRUCTURE_INVALID", and expiration failures still use "JWT_TOKEN_EXPIRED". These symbolic JWT codes describe local JWT checks where applicable; nonblank invalid or expired Inbox JWTs can instead be rejected by the backend as "UNAUTHORIZED". There is no current code collision, but the meaning of "20013" is version-dependent. Error handlers spanning old and new SDK versions must consider the SDK version and operation rather than universally treating "20013" as a JWT failure.
| 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 | The backend cannot find the registration, for example because it expired or became invalid. This is a server response, not the local SDK readiness error "20006" (InternalSdkError.NO_VALID_REGISTRATION); see local SDK errors. |
| 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) |
| INVALID_CURSOR | Invalid Inbox cursor | The supplied cursor is malformed or does not match its scope/filters. Reset pagination and fetch the first page without a cursor; see Inbox pagination. |
| 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 Customer Profiles -> Persons (formerly People -> Persons) section in your Infobip account |
| JWT_TOKEN_STRUCTURE_INVALID | JWT token structure invalid | This error is returned when token verification failed, check error's message for details |
| JWT_TOKEN_EXPIRED | JWT token is expired | This error is returned when token's expiration claim is in the past |
| 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 exist |
| 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 |
If you have any questions or suggestions, feel free to send an email to support@infobip.com or create an issue.