Error codes
Every MobbScanAPI callback receives a MobbScanAPIError as its last argument. It is null when the operation succeeds.
| Property | Type | Description |
|---|---|---|
| Error code | MobbScanAPIErrorCode | One of the codes in the table below |
getErrorReason() | ErrorReason | Specific reason sent by the backend, when available. See Error reason |
extraInfo | Map<String, String> | Additional details, when available |
Handle an error
Check the error code to decide what to show the user. The most common cases:
| Code | Recommended handling |
|---|---|
USER_CANCELLED_ERROR, SCANNING_PROCESS_CANCELLED | The user left the capture: return to the previous step |
CONNECTION_ERROR, TIMEOUT_ERROR | Ask the user to check the connection and retry |
PERMISSION_ERROR | Request the camera (and microphone) permission and retry |
DOCUMENT_NOT_VALID, DOCUMENT_NOT_CLASSIFIED | Ask for a valid document; read extraInfo for the reason |
LICENSE_ERROR, API_NOT_INITIALIZED_ERROR | Integration issue: check initAPI and the license |
- Kotlin
- Java
val failedValidations = error?.getExtraInfo()?.get("errorDetails")
println("Failed validations: $failedValidations")
// Failed validations: validationDocumentNotExpired
String failedValidations = error == null || error.getExtraInfo() == null
? null : error.getExtraInfo().get("errorDetails");
System.out.println("Failed validations: " + failedValidations);
// Failed validations: validationDocumentNotExpired
When a document does not pass the validations configured for your process, extraInfo["errorDetails"] lists the failed validations. Their meaning is described in the document object.
Error reason
getErrorReason() returns the specific reason sent by the backend, or null if there is none. ErrorReason is an extensible class, not an enum: compare predefined reasons with its constants (NOT_VALID_DOCUMENT, NOT_VALID_IMAGE, TOO_MANY_FEW_LINES, EMPTY_CORNERS, QR_NOT_DETECTED, FACE_NOT_DETECTED, BLURRING_CHECK_NOT_PASSED, ERROR_FRONT_DOCUMENT_SIDE_DUPLICATED, ERROR_BACK_DOCUMENT_SIDE_DUPLICATED) and any other reason with getValue().
- Kotlin
- Java
val reason = error?.getErrorReason()
when {
reason == null -> { /* No error, or the backend did not send a reason */ }
reason == ErrorReason.NOT_VALID_DOCUMENT -> {
val details = error.getExtraInfo()?.get("errorDetails")
// Document validation failed; inspect errorDetails for the specific reasons
}
reason.getValue() == "LIVENESS_FAILED" -> { /* Liveness failed */ }
reason.getValue() == "MATCHING_FAILED" -> { /* Face matching failed */ }
else -> { /* Other backend reasons: generic fallback */ }
}
if (error != null) {
ErrorReason reason = error.getErrorReason();
if (ErrorReason.NOT_VALID_DOCUMENT.equals(reason)) {
String details = error.getExtraInfo() == null ? null : error.getExtraInfo().get("errorDetails");
// Document validation failed; inspect errorDetails for the specific reasons
} else if (reason != null && "LIVENESS_FAILED".equals(reason.getValue())) {
// Liveness failed
} else if (reason != null && "MATCHING_FAILED".equals(reason.getValue())) {
// Face matching failed
} else if (reason != null) {
// Other backend reasons: generic fallback
}
}
Error codes
| Code | Meaning |
|---|---|
UNEXPECTED_ERROR | Something unexpected happened during the process |
CONNECTION_ERROR | A network connection error happened |
TIMEOUT_ERROR | The process timeout expired |
WRONG_PARAMETERS_ERROR | Some of the parameters are not valid |
SCANNING_PROCESS_CANCELLED | The user cancelled the scanning process |
DOCUMENT_NOT_CLASSIFIED | The system is not able to classify the document (only applicable for generic document types, i.e. ESP) |
DOCUMENT_NOT_VALID | The document did not pass the validations (applicable when specific validations are activated) |
DOCUMENT_NOT_DETECTED | The document could not be detected |
LICENSE_ERROR | The license is not valid or has not been configured |
PERMISSION_ERROR | The required app permissions have not been granted |
INTERNAL_SERVER_ERROR | An internal server error occurred |
UNAUTHORIZED_ERROR | The user is not authorized to perform the action |
API_NOT_INITIALIZED_ERROR | MobbScanAPI was not properly initialised |
DEVICE_NOT_COMPATIBLE | Device does not fulfill the minimum requirements |
DOCUMENT_NOT_AVAILABLE | The requested document type is not available |
OFFLINE_RESOURCES_NOT_FOUND | Offline resources could not be found |
NOT_AVAILABLE_IN_OFFLINE_MODE | This method is not available in offline mode |
CAPTURE_FACE_ERROR | Facial capture could not be completed |
USER_CANCELLED_ERROR | The user cancelled any process (document detection, face validation...) |
ANTISPOOFING_ERROR | The antispoofing mechanism cannot ensure the user is genuine |
CAMERA_ERROR | An error occurred while managing the camera |
ERROR_SCAN_PROCESS_IS_NOT_VALID | The scan process is not valid for facial verification |
SCAN_PROCESS_ALREADY_STARTED_ERROR | The scan process has already been started |
FACE_DOCUMENT_NOT_DETECTED_ERROR | No face was detected in the document |
Video liveness errors
Android v2.37.3 maps video-liveness response codes from the service to these MobbScanAPIErrorCode values. Keep the code and scanId in diagnostic logs; show users only a message appropriate to the capture flow.
| Code | What happened | Suggested handling |
|---|---|---|
VIDEO_LIVENESS_VIDEO_NO_FACE | No face was detected in the liveness video. | Ask the user to repeat the capture with their face clearly in frame. |
VIDEO_LIVENESS_NO_MOVEMENT | The required facial movement was not detected. | Ask the user to follow the on-screen prompt and retry the capture. |
VIDEO_LIVENESS_INVALID_FORMAT | The liveness video could not be processed in its submitted format. | Check that the integration supplies a supported video format. |
VIDEO_LIVENESS_MULTIPLE_FACES | More than one face was detected in the liveness video. | Ask the user to retry with only one person in frame. |
VIDEO_LIVENESS_PICTURE_NO_FACE | No face was detected in the supplied image. | Check that the image contains a visible face before sending it. |
VIDEO_LIVENESS_LIVENESS_ERROR | Liveness analysis could not be completed. | Treat this as a processing error; retain the code and scanId for diagnostics or support. |
VIDEO_LIVENESS_MATCHING_ERROR | Face matching could not be completed. | Check related validation details; do not treat this code alone as a confirmed mismatch. |
VIDEO_LIVENESS_WRONG_SCANID | The scanId does not belong to a started process. | Use the scanId returned for the current process. |
VIDEO_LIVENESS_SCANID_CREATION_ERROR | The liveness service could not start processing the session. | There is no corrective action in the app for this service-side failure. Log the code and scanId; contact support if it persists. |
VIDEO_LIVENESS_INVALID_METHOD | The selected liveness method is not supported for this process. | Check the configured method against the options supported by the SDK/service. |
VIDEO_LIVENESS_OUTPUT_GENERATION_ERROR | The liveness service could not produce a result. | Log the code and scanId; contact support if it persists. |