Skip to main content

Error code

The TextToSpeech SDK reports errors that occur during initialization, app registration, and speech synthesis as ErrorType. Handle these errors through OnInitializeListener, OnServerConnectionListener, or EventListener.

ErrorType​

ErrorTypeDescriptionRecommended action
AUDIO_ERRORAudio output or playback processing failed.Check the audio configuration and output device, and then try again.
INVALID_REQUEST_ERRORThe request value or request state is invalid.Check request conditions such as the text and API call order.
MIC_ERRORAn error occurred while processing the audio input device.Check the audio device state in the runtime environment.
NETWORK_ERRORNetwork communication failed.Check the network connection and try again.
NOT_SUPPORTED_APIThe API is not supported in the current mode or runtime environment.Check the selected Mode and platform support.
ON_DEVICE_ENGINE_ERRORAn error occurred in the on-device speech synthesis engine.Check the engine state or consider using HYBRID or SERVER mode.
PERMISSION_DENIEDThe app does not have permission to access the TextToSpeech service.Check the TTS_SERVICE permission in the manifest and the permission state in the runtime environment.
SERVER_INTERNAL_ERRORAn internal Speech Service error occurred.Try again later. If the problem continues, contact the service administrator.
TIMEOUTThe request did not complete within the time limit.Check the network and server status, and then try again.
UNAUTHENTICATEDApp authentication failed.Check the My Project credentials from Pleos Playground or the UA app credentials and target environment.
UNAVAILABLE_LANGUAGEThe requested language is unavailable.Select a supported Locale.
UNKNOWNAn unclassified error occurred.Collect the call timing and environment information and contact the service administrator.

Handle errors​

Because new error types can be added to ErrorType, we recommend including 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()
else -> logError(errorType.name)
}
}

For the exact declaration of each error type, see the TextToSpeech API Reference.