Skip to main content

Error code

The SpeechToText SDK reports errors that occur during initialization, app registration, and speech recognition as ErrorType. Handle these errors in OnInitializeListener, OnServerConnectionListener, or ResultListener.

ErrorType​

ErrorTypeDescriptionRecommended action
AUDIO_ERRORProcessing the input audio data failed.Check the input data and audio format, and then retry the request.
INVALID_REQUEST_ERRORA request value or the request state is invalid.Check the call order, duplicate requests, and input values.
MIC_ERRORAn error occurred while starting or processing microphone input.Check the microphone and sensor privacy settings.
NETWORK_ERRORNetwork communication failed.Check the network connection and retry the request.
NOT_SUPPORTED_APIThe API is not supported in the current mode or runtime environment.Check the selected Mode and the platform's supported functionality.
ON_DEVICE_ENGINE_ERRORAn error occurred in the On-device speech recognition engine.Check the engine state or consider HYBRID or SERVER mode.
PERMISSION_DENIEDThe app does not have permission to access the SpeechToText service.Check the STT_SERVICE permission in the manifest and the runtime permission state.
SERVER_INTERNAL_ERRORAn internal Speech Service error occurred.Retry later. If it persists, contact the service administrator.
TIMEOUTThe request did not complete within the time limit.Check the network and server state, and then retry.
UNAUTHENTICATEDApp authentication failed.Check the My Project credentials or UA app information in Pleos Playground and the target environment.
UNAVAILABLE_LANGUAGEThe requested language is unavailable.Change to a supported Locale.
UNKNOWNAn unclassified error occurred.Collect the call timing and environment details, and contact the service administrator.

Handle errors​

Because new error types may be added to ErrorType, include a default branch in a when or switch statement.

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

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