For the complete documentation index, see llms.txt. This page is also available as Markdown.

Handling Failures

When a liveness check fails, the SDK returns a LivenessLiteEvent.Failure event. This event contains a type parameter, a CafFailureType enum that tells you exactly why the process was unsuccessful.

Understanding and handling the type parameter is critical for providing clear, actionable feedback to your users so they can correct the issue and try again.

The Failure Model

The SDK delivers failures through the LivenessLiteEvent sealed interface. Both capture-level and recognition-level failures are reported as LivenessLiteEvent.Failure, ensuring you can always access the type and description.

LivenessLiteEvent.kt
public sealed interface LivenessLiteEvent {

    /**
     * Liveness failure event with specific failure type.
     *
     * @param response The signed response from the server
     * @param type The specific type of failure that occurred
     * @param description User-friendly description of the failure
     */
    public data class Failure(
        val response: String,
        val type: CafFailureType,
        val description: String
    ) : LivenessLiteEvent
}

Using the type Parameter

The type parameter returns a CafFailureType enum constant (e.g., TOO_DARK or FACE_TOO_FAR).

Best Practice: Do not display the raw enum name or the description directly to your end-users. Instead, intercept the type and map it to a user-friendly, localized message in your app's UI to guide them on how to fix the problem.

Available Failure Types

If the image capture is successful but the engine fails to authenticate or process the face, the SDK returns a LivenessLiteEvent.Failure.

Below is the list of possible CafFailureType values returned during this phase:

Type
Description

UNKNOWN

Generic failure

TOO_MUCH_MOVEMENT

Excessive head motion

TOO_BRIGHT

Over-illumination

TOO_DARK

Low light conditions

MISALIGNED_FACE

Face alignment failure

FACE_TOO_FAR

Face too distant

FACE_TOO_CLOSE

Face too close

SUNGLASSES

Eye-obscuring eyewear

OBSCURED_FACE

Partial face obstruction

EYES_CLOSED

Closed eyes during capture

MULTIPLE_FACES

Multiple faces detected

BACKGROUND_ISSUE

Unsuitable background

DEVICE_ISSUE

Incompatible device

EYEWEAR

Eyewear detected

FACE_NOT_FOUND

Face detection failure

FRAMES_BLURRY

Blurry frames detected

MOTION_ISSUE

Device motion error

LIGHTING_ISSUES

Poor lighting conditions

REJECTED

Transaction rejected

SYSTEM_ERROR

Internal system error

TIMEOUT

Session timeout

USER_NOT_FOUND

User lookup failure

DEVICE_RESTART

Device state error

PROCESSING_FAULT

Processing error

FACE_AUTHENTICATION

Face authentication failed

Example Implementation

Here is an example of how you might handle a LivenessLiteEvent.Failure and map the type parameter to helpful user guidance:

Links:

Face Liveness LiteHandling FailuresUi CustomizationChangelog

Last updated