Handle batch exceptions

The HBase API provides two ways to send multiple operations as a batch:

With the Cloud Bigtable HBase client for Java, both of these methods can throwaRetriesExhaustedWithDetailsException. This exception is thrownwhen one or more of the batch operations fail for any reason (for example,because the connection failed). It contains a list of failed requests, alongwith details about the exception that caused each request to fail.

By itself, aRetriesExhaustedWithDetailsException does not tell you why arequest failed. You must callRetriesExhaustedWithDetailsException#getCauses() to retrieve thedetailed exceptions for each failed request. You can then log information abouteach of the detailed exceptions, which will help you diagnose the failure:

try {  mutator.mutate(mutationList);} catch (RetriesExhaustedWithDetailsException e) {  for (Throwable cause : e.getCauses()) {    cause.printStackTrace();  }  throw e;}

An exception can also be thrown when you callflushorclose.The same error handling applies.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.