Skip to main content

Error code

The TextToSpeech SDK communicates errors that occur during initialization, app registration, and speech synthesis as ErrorType. Errors can be handled in OnInitializeListener, OnServerConnectionListener, or EventListener.

ErrorType

ErrorTypeDescriptionRecommended action
AUDIO_ERRORFailed to process audio output or playback.Check audio settings and output device status, then try again.
INVALID_REQUEST_ERRORThe request value or request status is incorrect.Verify request conditions such as text and call order.
MIC_ERRORAn error occurred while processing the audio input device.Check the status of the audio device in the execution environment.
NETWORK_ERRORFailed to communicate over the network.Check the network connection and try again.
NOT_SUPPORTED_APIThe API is not supported in the current mode or execution environment.Verify the selected Mode and platform support range.
ON_DEVICE_ENGINE_ERRORAn error occurred in the on-device speech synthesis engine.Check the engine status or consider HYBRID or SERVER mode.
PERMISSION_DENIEDAccess to the TextToSpeech service is denied.Check the TTS_SERVICE permission in the manifest and the permission status in the execution environment.
SERVER_INTERNAL_ERRORAn internal error occurred in the Speech Service.Try again later, and if it persists, contact the service administrator.
TIMEOUTThe request could not be completed within the time limit.Check the network and server status, then try again.
UNAUTHENTICATEDApp authentication failed.Verify credentials in Pleos Playground's My Project or UA app information and connection environment.
UNAVAILABLE_LANGUAGEThe requested language is not available.Change to a supported Locale.
UNKNOWNAn unclassified error occurred.Collect information about the call timing and environment, then contact the service administrator.
UNCLASSIFIED(message)An error not defined by the SDK, including the original message.Record the message and determine the cause based on it.

Handle errors

Since new error types may be added to ErrorType, it is recommended to include a default branch in when or switch statements.

override fun onError(errorType: ErrorType) {
when (errorType) {
ErrorType.PERMISSION_DENIED -> checkTtsPermission()
ErrorType.UNAUTHENTICATED -> checkCredentials()
ErrorType.NETWORK_ERROR,
ErrorType.TIMEOUT -> retryWhenNetworkIsAvailable()
is ErrorType.UNCLASSIFIED -> logError(errorType.message)
else -> logError(errorType.name)
}
}

The exact declaration of each error type can be found in the TextToSpeech API Reference.