目录

ArkTS API Error Codes

This section describes only module-specific error codes. For details about universal error codes, please refer to Universal Error Codes.

401 Parameter Error

Message

The parameter check failed.

Description

The input parameters are incorrect.

Possible causes

The type of an input parameter or the parameter value is incorrect, for example, the input language is not Chinese.

Solution

Ensure that the input parameters are correct and try again.

1002200001 Engine Creation Failed

Message

Create engine failed.

Description

Engine creation failed.

Possible causes

  1. The language is not supported.
  2. The mode is not supported.
  3. The needed resource does not exist, or the initialization times out.

Solution

  1. Call the listLanguages method to query the supported languages. Then try again.
  2. Confirm the mode (only CreateEngineParams is supported currently) and try again.
  3. If the needed resource does not exist or the initialization times out, try again later.

1002200002 Failed to Start Recognition

Message

Start listening failed.

Description

Failed to start recognition.

Possible causes

Speech recognition has already been started and is started again.

Solution

Try again later.

1002200003 Audio Too Long

Message

Exceeded the maximum audio length supported.

Description

The audio length exceeds the maximum.

Possible causes

The audio length exceeds the maximum.

Solution

It is recommended that the audio not exceed 60,000 ms. Adjust the length and try again.

1002200004 Failed to End Recognition

Message

Finish recognition failed.

Description

Failed to end recognition.

Possible causes

No recognition task exists.

Solution

Call the startListening method to start the speech recognition task and try again.

1002200005 Failed to Cancel Recognition

Message

Cancel recognition failed.

Description

Failed to cancel recognition.

Possible causes

No recognition task exists.

Solution

Call the startListening method to start the speech recognition task and try again.

1002200006 The Service Is Busy

Message

The engine of SpeechRecognition is busy.

Description

The recognition service is busy.

Possible causes

The engine is performing a recognition task.

Solution

Call the isBusy method to query the service status and try again when the service is idle.

1002200007 Engine Not Initialized

Message

The engine is not initialized.

Description

The engine has not been initialized.

Possible causes

The engine has not been initialized.

Solution

Call the speechRecognizer.createEngine method to initialize the engine and try again.

1002200010 Speech Recognition Not Started

Message

Write audio failed because the start listening is failed.

Description

The engine has not started recognition.

Possible causes

The engine has not started recognition.

Solution

Call the startListening method to start the speech recognition task and try again.

1002200012 No Microphone Permission

Message

AudioCapturer create failed, please check the permission of MICROPHONE.

Description

Failed to create the AudioCapturer. The microphone permission needs to be checked.

Possible causes

No microphone permission is obtained.

Solution

Check whether the microphone permission can be obtained.

1002300001 Invalid Text Length

Message

The length of text is out of range or empty.

Description

Invalid text length.

Possible causes

The text length is 0 or exceeds 10,000 characters.

Solution

Modify the text and try again.

1002300002 Unsupported Language

Message

The language is not supported.

Description

The language is not supported.

Possible causes

The language is not supported. Currently, only Chinese is supported.

Solution

Call the listVoices method to query the supported languages. Use the supported language and try again.

1002300005 Engine Creation Failed

Message

Create engine failed.

Description

Engine creation failed.

Possible causes

1. The engine service is abnormal.

2. Failed to load engine resources.

Solution

Try again later.

1002300006 The Service Is Busy

Message

The service of TextToSpeech is busy.

Description

The text-to-speech service is busy.

Possible causes

The engine is performing a synthesis or playback task.

Solution

Try again later.

1002300007 Engine Not Initialized

Message

The Text-to-Speech engine is not initialized.

Description

The engine has not been initialized.

Possible causes

The engine has not been initialized.

Solution

Call the createEngine method to initialize the engine and then perform synthesis.