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.
See https://developers.google.com/accounts/docs/application-default-credentials
for more information.

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

You must have a service account for your project, downloaded 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, our 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.

"Must use single channel (mono) audio"

If you receive this message:

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

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:

RESOURCE_EXHAUSTED: Quota exceeded.

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.

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Speech-to-Text API