# FirebaseMlException


```
public class FirebaseMlException extends FirebaseException
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/kotlin/java/lang/Object.html) |||||
| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/kotlin/java/lang/Exception.html) |||
|   |   | ↳ | [com.google.firebase.FirebaseException](https://firebase.google.com/docs/reference/android/com/google/firebase/FirebaseException) ||
|   |   |   | ↳ | [com.google.firebase.ml.modeldownloader.FirebaseMlException](https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Represents an Exception resulting from an operation on a `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseModelDownloader`. Error mappings should remain consistent with the original firebase_ml_sdk whenever possible.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntDef.html(value = ) @https://developer.android.com/reference/kotlin/java/lang/annotation/Retention.html(value = RetentionPolicy.CLASS) public annotation https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException.Code` **This annotation is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |

| ### Constants |
|---|---|
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#ABORTED() = 10` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#ALREADY_EXISTS() = 6` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#CANCELLED() = 1` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#DEADLINE_EXCEEDED() = 4` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#DOWNLOAD_URL_EXPIRED() = 121` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#FAILED_PRECONDITION() = 9` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#INTERNAL() = 13` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#INVALID_ARGUMENT() = 3` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#MODEL_HASH_MISMATCH() = 102` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#NOT_ENOUGH_SPACE() = 101` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#NOT_FOUND() = 5` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#NO_NETWORK_CONNECTION() = 17` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#OUT_OF_RANGE() = 11` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#PERMISSION_DENIED() = 7` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#RESOURCE_EXHAUSTED() = 8` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#UNAUTHENTICATED() = 16` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#UNAVAILABLE() = 14` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#UNIMPLEMENTED() = 12` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |
| `static final int` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#UNKNOWN() = 2` **This field is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |

| ### Public fields |
|---|---|
| `final int` | `@https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException.Code https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#code()` |

| ### Public methods |
|---|---|
| `int` | `@https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException.Code [getCode](https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#getCode())()` **This method is deprecated.** Firebase ML is deprecated and will be shut down on June 15, 2027. <br /> |

| ### Inherited methods |
|---|
| From [java.lang.Throwable](https://developer.android.com/reference/kotlin/java/lang/Throwable.html) |---|---| | `synchronized final void` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-(https://developer.android.com/reference/kotlin/java/lang/Throwable.html exception)` | | `synchronized https://developer.android.com/reference/kotlin/java/lang/Throwable.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#fillInStackTrace--()` | | `synchronized https://developer.android.com/reference/kotlin/java/lang/Throwable.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getCause--()` | | `https://developer.android.com/reference/kotlin/java/lang/String.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getLocalizedMessage--()` | | `https://developer.android.com/reference/kotlin/java/lang/String.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getMessage--()` | | `StackTraceElement[]` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getStackTrace--()` | | `synchronized final Throwable[]` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#getSuppressed--()` | | `synchronized https://developer.android.com/reference/kotlin/java/lang/Throwable.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#initCause-java.lang.Throwable-(https://developer.android.com/reference/kotlin/java/lang/Throwable.html cause)` | | `void` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#printStackTrace--()` | | `void` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-(StackTraceElement[] stackTrace)` | | `https://developer.android.com/reference/kotlin/java/lang/String.html` | `https://developer.android.com/reference/kotlin/java/lang/Throwable.html#toString--()` | |

## Constants

### ABORTED

```
public static final int ABORTED = 10
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.

### ALREADY_EXISTS

```
public static final int ALREADY_EXISTS = 6
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Some resource that we attempted to create already exists.

### CANCELLED

```
public static final int CANCELLED = 1
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The operation was cancelled (typically by the caller).

### DEADLINE_EXCEEDED

```
public static final int DEADLINE_EXCEEDED = 4
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.

### DOWNLOAD_URL_EXPIRED

```
public static final int DOWNLOAD_URL_EXPIRED = 121
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The download URL expired before download could complete. Usually, multiple download attempts will be performed before this is returned.

### FAILED_PRECONDITION

```
public static final int FAILED_PRECONDITION = 9
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Operation was rejected because the system is not in a state required for the operation's execution.

### INTERNAL

```
public static final int INTERNAL = 13
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Internal errors. Means some invariant expected by underlying system has been broken. If you see one of these errors, something is very broken.

### INVALID_ARGUMENT

```
public static final int INVALID_ARGUMENT = 3
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Client specified an invalid argument. Note that this differs from `FAILED_PRECONDITION
`. `INVALID_ARGUMENT` indicates arguments that are problematic regardless of the state of the system (for example, an invalid field name).

### MODEL_HASH_MISMATCH

```
public static final int MODEL_HASH_MISMATCH = 102
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The downloaded model's hash doesn't match the expected value.

### NOT_ENOUGH_SPACE

```
public static final int NOT_ENOUGH_SPACE = 101
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

There is not enough space left on the device.

### NOT_FOUND

```
public static final int NOT_FOUND = 5
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Some requested resource was not found.

### NO_NETWORK_CONNECTION

```
public static final int NO_NETWORK_CONNECTION = 17
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

There is no network connection.

### OUT_OF_RANGE

```
public static final int OUT_OF_RANGE = 11
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Operation was attempted past the valid range.

### PERMISSION_DENIED

```
public static final int PERMISSION_DENIED = 7
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The caller does not have permission to execute the specified operation.

### RESOURCE_EXHAUSTED

```
public static final int RESOURCE_EXHAUSTED = 8
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.

### UNAUTHENTICATED

```
public static final int UNAUTHENTICATED = 16
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The request does not have valid authentication credentials for the operation.

### UNAVAILABLE

```
public static final int UNAVAILABLE = 14
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.

In ML Model Downloader, this error is mostly about the models being not available yet.

### UNIMPLEMENTED

```
public static final int UNIMPLEMENTED = 12
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Operation is not implemented or not supported/enabled.

### UNKNOWN

```
public static final int UNKNOWN = 2
```

> [!CAUTION]
> **This field is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Unknown error or an error from a different error domain.

## Public fields

### code

```
@FirebaseMlException.Code
public final int code
```

## Public methods

### getCode

```
@FirebaseMlException.Code
public int [getCode](https://firebase.google.com/docs/reference/android/com/google/firebase/ml/modeldownloader/FirebaseMlException#getCode())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Gets the error code for the Firebase ML operation that failed.