# GenAiException.ErrorCode


```
@IntDef(value = [ErrorCode.BUSY, ErrorCode.CANCELLED, ErrorCode.NEEDS_SYSTEM_UPDATE, ErrorCode.NOT_AVAILABLE, ErrorCode.NOT_ENOUGH_DISK_SPACE, ErrorCode.NOT_SUPPORTED, ErrorCode.REQUEST_PROCESSING_ERROR, ErrorCode.REQUEST_TOO_LARGE, ErrorCode.RESPONSE_GENERATION_ERROR, ErrorCode.RESPONSE_PROCESSING_ERROR, ErrorCode.REQUEST_TOO_SMALL, ErrorCode.AICORE_INCOMPATIBLE, ErrorCode.INVALID_INPUT_IMAGE, ErrorCode.PER_APP_BATTERY_USE_QUOTA_EXCEEDED, ErrorCode.BACKGROUND_USE_BLOCKED, ErrorCode.CACHE_PROCESSING_ERROR, ErrorCode.STRUCTURED_OUTPUT_REQUEST_ERROR, ErrorCode.STRUCTURED_OUTPUT_RESPONSE_ERROR, ErrorCode.STRUCTURED_OUTPUT_MAX_TOKENS_ERROR, ErrorCode.AUDIO_BUFFER_OVERFLOW])
annotation GenAiException.ErrorCode
```

<br />

*** ** * ** ***

The set of error codes.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#AICORE_INCOMPATIBLE() = -101` AICore is not installed or its version is too low. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#AUDIO_BUFFER_OVERFLOW() = -107` Audio buffer overflow. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#BACKGROUND_USE_BLOCKED() = 30` Background usage is blocked. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#BUSY() = 9` The service is currently busy. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#CACHE_PROCESSING_ERROR() = -103` Error during cache processing for prompt prefix. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#CANCELLED() = 7` The request is cancelled. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#INVALID_INPUT_IMAGE() = -102` Invalid input image. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#NEEDS_SYSTEM_UPDATE() = 604` Android version is too low. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#NOT_AVAILABLE() = 8` Feature is not available. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#NOT_ENOUGH_DISK_SPACE() = 501` Not enough storage. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#NOT_SUPPORTED() = 16` The functionality is not implemented nor supported by the inference engine. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#PER_APP_BATTERY_USE_QUOTA_EXCEEDED() = 27` A long-duration (for example per-day) quota for the calling app's uid has been exceeded. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#REQUEST_PROCESSING_ERROR() = 4` Request doesn't pass certain policy check. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#REQUEST_TOO_LARGE() = 12` Request is too large to be processed. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#REQUEST_TOO_SMALL() = -100` Request is too small to be processed. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#RESPONSE_GENERATION_ERROR() = 15` The model cannot generate a response due to request not passing certain policy check. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#RESPONSE_PROCESSING_ERROR() = 11` Generated response doesn't pass certain policy check. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#STRUCTURED_OUTPUT_MAX_TOKENS_ERROR() = -106` Error during structured output response processing due to reaching max tokens limit. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#STRUCTURED_OUTPUT_REQUEST_ERROR() = -104` Error during structured output request generation. |
| `const https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developers.google.com/android/reference/kotlin/com/google/mlkit/genai/common/GenAiException.ErrorCode#STRUCTURED_OUTPUT_RESPONSE_ERROR() = -105` Error during structured output response processing. |

## Constants

### AICORE_INCOMPATIBLE

```
const val AICORE_INCOMPATIBLE = -101: Int
```

AICore is not installed or its version is too low.

### AUDIO_BUFFER_OVERFLOW

```
const val AUDIO_BUFFER_OVERFLOW = -107: Int
```

Audio buffer overflow. The audio input rate is too fast.

### BACKGROUND_USE_BLOCKED

```
const val BACKGROUND_USE_BLOCKED = 30: Int
```

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

### BUSY

```
const val BUSY = 9: Int
```

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).

### CACHE_PROCESSING_ERROR

```
const val CACHE_PROCESSING_ERROR = -103: Int
```

Error during cache processing for prompt prefix.

### CANCELLED

```
const val CANCELLED = 7: Int
```

The request is cancelled.

### INVALID_INPUT_IMAGE

```
const val INVALID_INPUT_IMAGE = -102: Int
```

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

### NEEDS_SYSTEM_UPDATE

```
const val NEEDS_SYSTEM_UPDATE = 604: Int
```

Android version is too low.

### NOT_AVAILABLE

```
const val NOT_AVAILABLE = 8: Int
```

Feature is not available.

### NOT_ENOUGH_DISK_SPACE

```
const val NOT_ENOUGH_DISK_SPACE = 501: Int
```

Not enough storage.

### NOT_SUPPORTED

```
const val NOT_SUPPORTED = 16: Int
```

The functionality is not implemented nor supported by the inference engine.

### PER_APP_BATTERY_USE_QUOTA_EXCEEDED

```
const val PER_APP_BATTERY_USE_QUOTA_EXCEEDED = 27: Int
```

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.

### REQUEST_PROCESSING_ERROR

```
const val REQUEST_PROCESSING_ERROR = 4: Int
```

Request doesn't pass certain policy check.

### REQUEST_TOO_LARGE

```
const val REQUEST_TOO_LARGE = 12: Int
```

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

### REQUEST_TOO_SMALL

```
const val REQUEST_TOO_SMALL = -100: Int
```

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

### RESPONSE_GENERATION_ERROR

```
const val RESPONSE_GENERATION_ERROR = 15: Int
```

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.

### RESPONSE_PROCESSING_ERROR

```
const val RESPONSE_PROCESSING_ERROR = 11: Int
```

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.

### STRUCTURED_OUTPUT_MAX_TOKENS_ERROR

```
const val STRUCTURED_OUTPUT_MAX_TOKENS_ERROR = -106: Int
```

Error during structured output response processing due to reaching max tokens limit.

### STRUCTURED_OUTPUT_REQUEST_ERROR

```
const val STRUCTURED_OUTPUT_REQUEST_ERROR = -104: Int
```

Error during structured output request generation.

### STRUCTURED_OUTPUT_RESPONSE_ERROR

```
const val STRUCTURED_OUTPUT_RESPONSE_ERROR = -105: Int
```

Error during structured output response processing.