GenAiException.ErrorCode

  • GenAiException.ErrorCode is an annotation defining a set of error codes for the service.

  • The errors cover various scenarios including service busyness, cancellation, outdated system versions, feature unavailability, insufficient disk space, and request/response processing issues.

  • Specific error codes exist for requests being too large or too small, and for failures in response generation.

  • The annotation inherits standard methods from java.lang.annotation.Annotation like annotationType, equals, hashCode, and toString.

public static abstract @interface GenAiException.ErrorCode implements Annotation

The set of error codes.

Constant Summary

int AICORE_INCOMPATIBLE AICore is not installed or its version is too low.
int BACKGROUND_USE_BLOCKED Background usage is blocked.
int BUSY The service is currently busy.
int CACHE_PROCESSING_ERROR Error during cache processing for prompt prefix.
int CANCELLED The request is cancelled.
int INVALID_INPUT_IMAGE Invalid input image.
int NEEDS_SYSTEM_UPDATE Android version is too low.
int NOT_AVAILABLE Feature is not available.
int NOT_ENOUGH_DISK_SPACE Not enough storage.
int PER_APP_BATTERY_USE_QUOTA_EXCEEDED A long-duration (for example per-day) quota for the calling app's uid has been exceeded.
int REQUEST_PROCESSING_ERROR Request doesn't pass certain policy check.
int REQUEST_TOO_LARGE Request is too large to be processed.
int REQUEST_TOO_SMALL Request is too small to be processed.
int RESPONSE_GENERATION_ERROR The model cannot generate a response due to request not passing certain policy check.
int RESPONSE_PROCESSING_ERROR Generated response doesn't pass certain policy check.

Inherited Method Summary

Constants

public static final int AICORE_INCOMPATIBLE

AICore is not installed or its version is too low.

Constant Value: -101

public static final int BACKGROUND_USE_BLOCKED

Background usage is blocked. Please use the API when your app is in the foreground instead.

Constant Value: 30

public static final int BUSY

The service is currently busy.

This is either because your app is out of usage quota (please retry with exponential backoff) or the request is from disallowed background usage (please use the API when your app is in the foreground instead).

Constant Value: 9

public static final int CACHE_PROCESSING_ERROR

Error during cache processing for prompt prefix.

Constant Value: -103

public static final int CANCELLED

The request is cancelled.

Constant Value: 7

public static final int INVALID_INPUT_IMAGE

Invalid input image. It can be due to invalid image URL, failure to decode to bitmap, invalid mime type or other image processing failures.

Constant Value: -102

public static final int NEEDS_SYSTEM_UPDATE

Android version is too low.

Constant Value: 604

public static final int NOT_AVAILABLE

Feature is not available.

Constant Value: 8

public static final int NOT_ENOUGH_DISK_SPACE

Not enough storage.

Constant Value: 501

public static final int PER_APP_BATTERY_USE_QUOTA_EXCEEDED

A long-duration (for example per-day) quota for the calling app's uid has been exceeded. Use of AICore from this app has been restricted to preserve battery.

Constant Value: 27

public static final int REQUEST_PROCESSING_ERROR

Request doesn't pass certain policy check.

Constant Value: 4

public static final int REQUEST_TOO_LARGE

Request is too large to be processed. Use a smaller input.

Constant Value: 12

public static final int REQUEST_TOO_SMALL

Request is too small to be processed. Use a longer input.

Constant Value: -100

public static final int RESPONSE_GENERATION_ERROR

The model cannot generate a response due to request not passing certain policy check.

When using streaming mode with a supported API, this error may interrupt output streaming, leading to an incomplete result. Consider removing the result entirely from your app's UI when this occurs.

Constant Value: 15

public static final int RESPONSE_PROCESSING_ERROR

Generated response doesn't pass certain policy check.

When using streaming mode with a supported API, this error may interrupt output streaming, leading to an incomplete result. Consider removing the result entirely from your app's UI when this occurs.

Constant Value: 11