Error messages

Learn how to resolve some errors raised by Speech-to-Text. This topic discusses errors whose resolutions require more steps than can be easily described in an error message.

"The Application Default Credentials are not available"

If you receive this message:

The Application Default Credentials are not available. They are
available if running in Google Compute Engine. Otherwise, the
environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined
pointing to a file defining the credentials.
for more information.

Speech-to-Text uses Application Default Credentials for authentication.

You must have a service account for your project, download the key (JSON file) for your service account to your development environment, and then set the location of that JSON file to an environment variable named GOOGLE_APPLICATION_CREDENTIALS.

Furthermore, the GOOGLE_APPLICATION_CREDENTIALS environment variable must be available within the context that you call the Speech-to-Text API. For example, if you set the variable from within an terminal session but run your code in the debugger of your IDE, the execution context of your code might not have access to the variable. In that circumtance, your request to Speech-to-Text might fail for lack of proper authentication.

For more information on how to set the GOOGLE_APPLICATION_CREDENTIALS environment variable, see the Speech-to-Text quickstarts or the documentation on using the Application Default Credentials.

"File ... (pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not exist!"

If you receive this message:

ERROR: (gcloud.auth.application-default.print-access-token) File /path/to/key.json
(pointed by GOOGLE_APPLICATION_CREDENTIALS environment variable) does not exist!
  "error": {
    "code": 403,
    "message": "The request is missing a valid API key.",
    "status": "PERMISSION_DENIED"

Verify that you have a valid service account key JSON file in the location stored in the GOOGLE_APPLICATION_CREDENTIALS environment variable and that the variable points to the correct place.

To diagnose this error, try opening the service account key file from the folder from which you're attempting to call the Speech-to-Text API.


"Must use single channel (mono) audio"

If you receive this message:

Must use single channel (mono) audio, but WAV header indicates 2

Your audio file contains more than one channel. To transcribe this audio file, you must declare that your audio has multiple channels.

"Sync input too long"

If you receive this message:

Sync input too long. For audio longer than 1 min use
LongRunningRecognize with a 'uri' parameter.

The synchronous recognize method for Speech-to-Text only supports transcribing audio data up to 1 minute in length. For longer audio data, use asynchronous recognize instead.

"Invalid recognition 'config': bad encoding"

If you receive this message:

Invalid recognition 'config': bad encoding.

Your audio data might not be encoded correctly or is encoded with a codec different than what you've declared in the RecognitionConfig. Check the audio input and make sure that you've set the encoding field correctly.

"Request payload size exceeds the limit"

If you receive this message:

Request payload size exceeds the limit.

Your audio data is too large in size. Review the quotas & limits for using Speech-to-Text.

"Quota exceeded"

If you receive this message:


You have reached the limit of your per-minute or daily quota. Review the quotas & limits for using Speech-to-Text.

You can request an increase to your quotas from the Google Cloud Platform Console.

Hai trovato utile questa pagina? Facci sapere cosa ne pensi:

Invia feedback per...

Cloud Speech-to-Text
Hai bisogno di assistenza? Visita la nostra pagina di assistenza.