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
public sealed interface LivenessLiteEvent {
public data class Error(
val type: CafLivenessErrorType,
val description: String,
val cause: Throwable
) : LivenessLiteEvent
}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.
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
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 beforeconfigure().mobileTokenorpersonIdis 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.
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.
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.
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
descriptionsays 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.
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.
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

