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

Error Handling

When the liveness process cannot be completed, the SDK returns a LivenessLiteEvent.Error event. This event contains a type parameter, a CafLivenessErrorType enum that tells you why the process stopped.

Errors are different from failures:

  • A failure (LivenessLiteEvent.Failure) means the capture ran, but the user did not pass the check. It always carries a signed response. See Failure Reasons and User Guidance.

  • An error (LivenessLiteEvent.Error) means a technical problem prevented the SDK from starting or finishing the process. No capture was evaluated, so there is no signed response.

The Error Model

LivenessLiteEvent.kt
public sealed interface LivenessLiteEvent {
    public data class Error(
        val type: CafLivenessErrorType,
        val description: String,
        val cause: Throwable
    ) : LivenessLiteEvent
}
Parameter
Description

type

The error category. Use it to decide what to show and whether to retry.

description

A technical message in English. Use it for logs, not for your end users.

cause

The original exception. Send it to your crash or error reporting tool.

An error always ends the liveness run. You can call startLiveness() again right after receiving it.

Using the type Parameter

Best Practice: Do not display the raw enum name or the description to your end users. Map the type to a localized message in your app, and log the description and cause so your team can investigate.

In most cases, the user cannot solve an error by changing how they do the capture. The exceptions are the camera permission and the connection. Other errors point to an integration problem, such as a missing configure() call, and must be fixed in your app or account setup.

Error Types at a Glance

Type
Category
Typical cause
Recommended message

CONFIGURATION_EXCEPTION

Integration

The SDK was started without the required configuration.

We couldn't complete the verification.

TOKEN_EXCEPTION

Integration

The mobileToken is not set up for the liveness flow.

We couldn't complete the verification. Please try again.

CAMERA_PERMISSION

User

Camera access was denied.

Allow camera access to continue.

NETWORK_EXCEPTION

Environment

The session could not be created, or the connection dropped.

No connection. Check your internet and try again.

SERVER_EXCEPTION

Environment

The liveness service returned an error.

We couldn't complete the verification. Please try again.

SECURITY_EXCEPTION

Environment

One or more security checks of the environment failed.

We couldn't complete the verification. Please try again.

UNSUPPORTED_DEVICE

Environment

The device does not meet the capture requirements.

We couldn't complete the verification.

GENERIC_EXCEPTION

Other

An unexpected error with no known cause.

We couldn't complete the verification. Please try again.

LIVENESS_EXCEPTION

Other

Reserved. Not returned today.

We couldn't complete the verification. Please try again.

Integration errors

These errors usually point to a problem in the integration between your app and the SDK, not to something the user can solve.

CONFIGURATION_EXCEPTION

The SDK was started without the configuration required to open the verification. It happens in three cases:

  • startLiveness() was called before configure().

  • mobileToken or personId is empty or blank.

  • startLiveness() was called while another liveness run was still active.

Recommended message: We couldn't complete the verification.

Retry: no. Fix the app setup.

What to do: send the user to support or to another channel. In your app, call CafFaceLivenessLite.instance.configure(context, config) with a valid mobileToken and personId before startLiveness(), and wait for the current run to return a final event before starting a new one.

A new attempt does not change the result. This error should not be frequent in production, so monitor it and set up an alert when it happens. Use the description to tell the three cases apart in your logs.

TOKEN_EXCEPTION

The mobileToken is not set up for the liveness flow, so the session could not be created. Common causes:

  • Liveness is not enabled for the account or the token configuration.

  • The session returned by the server was incomplete, for example without the attempt identifier or the signed response.

Recommended message: We couldn't complete the verification. Please try again.

Retry: yes, with a new token.

What to do: offer a new attempt with a new token. If the error persists with fresh tokens, check the token configuration with Certta.

Create the token right before opening the SDK, and create a new one for every new attempt.

User and environment errors

These errors depend on the user, the device or the network. Show a helpful message and let the user try again when it makes sense.

CAMERA_PERMISSION

Camera access was denied, and the SDK cannot start the capture. Common causes:

  • The user denied access when asked for the permission.

  • The permission was denied before. After some refusals, the system may not ask again.

  • A one-time permission has already expired.

  • The permission was revoked in the settings or blocked by device restrictions, such as parental controls or corporate device management.

Recommended message: Allow camera access to continue.

Retry: yes, after the user grants the permission.

What to do: show a specific screen with a button that opens the app settings.

Since the system may not show the permission request again, the button should open the app settings directly instead of just retrying.

NETWORK_EXCEPTION

The SDK could not create the liveness session, or the connection dropped during the capture. Common causes:

  • No internet, or airplane mode on.

  • A weak or unstable signal, such as in an elevator, the subway or a basement.

  • The network changed during the verification.

  • A public Wi-Fi that requires a login that was not done yet.

  • A VPN, proxy or firewall blocking the services used by the SDK.

  • A failure validating the security certificate of the connection, caused by an antivirus or a proxy that inspects traffic, a corporate network that intercepts traffic, or a wrong date and time on the device.

  • The Certta services refused the session request, for example because the token is expired, invalid, reused or from another environment. In this case, the description says the liveness session could not be created.

Recommended message: No connection. Check your internet and try again.

Retry: yes.

What to do: show a connection screen with a button to try again.

Create the token right before opening the SDK, and create a new one for every new attempt. This avoids errors caused by expired tokens. An expired or invalid token is reported as NETWORK_EXCEPTION, not as TOKEN_EXCEPTION.

SERVER_EXCEPTION

The liveness service returned an error during the capture. Common causes:

  • Momentary instability or unavailability of the liveness services.

  • The liveness session was invalidated on the server side.

Recommended message: We couldn't complete the verification. Please try again.

Retry: yes. If it keeps happening, check your logs.

SECURITY_EXCEPTION

enableSecurity is true, and one or more security checks of the environment failed before or during the capture. The SDK blocked the capture to protect the journey. Common causes:

  • A rooted device, including Magisk or Zygisk.

  • Hooking frameworks, such as Frida, Xposed or LSPosed.

  • Hooking or injection libraries loaded into the app, or system functions redirected or patched at runtime.

  • A debugger attached to the app, a process tracing the app, or an app built as debuggable.

  • A conflict between your app's own protection and the SDK's security module.

  • A security check that could not run. The SDK treats it as a threat.

Recommended message: We couldn't complete the verification. Please try again.

Retry: yes. If it keeps happening, send the user to another verification path.

What to do: show a generic message. The finding is saved on the device, so the same device returns the same error until the app data is cleared or the app is reinstalled. See Security Checks.

UNSUPPORTED_DEVICE

The device does not meet the minimum hardware or system requirements for the capture. Common causes:

  • No front camera.

  • Missing hardware features required by the capture, which is common on very old devices.

Recommended message: We couldn't complete the verification.

Retry: no.

What to do: send the user to support or to another channel.

Other errors

GENERIC_EXCEPTION

An unexpected SDK error that does not fit any of the cases above. Common causes:

  • The app is in split-screen or multi-window mode.

  • The camera could not be opened or failed during the capture, for example because another app is using it.

  • An unexpected exception during the liveness flow.

Recommended message: We couldn't complete the verification. Please try again.

Retry: yes. If it keeps happening, check your logs.

For these cases, the technical log is essential. Record the type, the description, the SDK version, the device model and the Android version, and share them with Certta so the case can be mapped.

LIVENESS_EXCEPTION

Reserved for future use. Face Liveness Lite does not return this type today.

Retry: same as GENERIC_EXCEPTION.

What to do: handle it like GENERIC_EXCEPTION.

Last updated