Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Cloud Speech-to-Text V2 StreamingRecognize CANCELLED when using `cmn-Hans-CN`

I’m using Google Cloud Speech-to-Text V2 in an Android (Java) app. With languageCode set to "ja-JP" or "en-US", streaming recognition works perfectly. As soon as I switch only the language code to "cmn-Hans-CN", the call fails immediately with a CANCELLED error.

Environment & Config:

  • Model: chirp_2
  • Endpoint: us-central1-speech.googleapis.com:443
  • SDK: com.google.cloud:speech-v2:latest
  • Platform: Android (Java)

Relevant code snippet:

// Build recognition config
RecognitionConfig config = RecognitionConfig.newBuilder()
    .setModel("chirp_2")
    .setLanguageCode("cmn-Hans-CN")  // ← fails here
    .build();
StreamingRecognitionConfig streamingConfig =
    StreamingRecognitionConfig.newBuilder()
        .setConfig(config)
        .build();

// Start streaming
try (SpeechClient client = SpeechClient.create(
         SpeechSettings.newBuilder()
             .setEndpoint("us-central1-speech.googleapis.com:443")
             .build())) {
    ClientStream<StreamingRecognizeRequest> stream =
        client.streamingRecognizeCallable()
              .splitCall(responseObserver);
    // First request with config
    stream.send(StreamingRecognizeRequest.newBuilder()
          .setStreamingConfig(streamingConfig)
          .build());
    // Then send audio data...
} catch (Exception e) {
    Log.e("SpeechTest", "Streaming failed", e);
}

Error Log: 

com.google.api.gax.rpc.CancelledException:
 io.grpc.StatusRuntimeException: CANCELLED: The operation was cancelled. at 
com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:…) at 
com.google.cloud.speech.v2.StreamingRecognizeClient.streamingRecognizeCallable(StreamingRe
cognizeClient.java:…) … 05-14 16:42:40.052 26220 26279 E MyApp: 
com.google.api.gax.rpc.CancelledException: io.grpc.StatusRuntimeException: CANCELLED: The 
operation was cancelled.

Confirmed that the same code/config works for ja-JP and en-US.

Tried both cmn-Hans-CN and zh-CN—both cancel immediately.

Verified network connectivity and valid credentials.

0 0 70
0 REPLIES 0