# errors

Python API: `hubai_sdk.errors`

Exceptions raised for HubAI API and user-input failures.

Service functions translate HTTP failures into this hierarchy so callers do not need to inspect status codes. Catch
[HubApiError](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) to handle every
remote API failure, or one of its subclasses when recovery depends on the cause.

## Classes

| Name | Description |
| --- | --- |
| [`HubApiError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) | Base
exception for errors reported by the HubAI API. |
| [`InputError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) | Raised when
SDK input is incomplete or internally inconsistent. |
| [`ResourceAmbiguousError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |
Raised when an identifier matches more than one HubAI resource. |
| [`ResourceConflictError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |
Raised when an operation conflicts with an existing resource. |
| [`ResourceNotFoundError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |
Raised when a requested HubAI resource cannot be resolved. |
| [`ValidationError`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) | Raised
when HubAI rejects request fields or values. |

### exception `HubApiError`

```python
class HubApiError(Exception)
```

Base exception for errors reported by the HubAI API.

Attributes

| Name | Description |
| --- | --- |
| `status_code` | HTTP status code returned by HubAI, when available. |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |  |

#### method `__init__`

```python
def __init__(message: str, *, status_code: int | None = None)
```

### exception `InputError`

```python
class InputError(ValueError)
```

Raised when SDK input is incomplete or internally inconsistent.

### exception `ResourceAmbiguousError`

```python
class ResourceAmbiguousError(HubApiError, LookupError)
```

Raised when an identifier matches more than one HubAI resource.

Attributes

| Name | Description |
| --- | --- |
| `endpoint` |  |
| `identifier` |  |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |  |

#### method `__init__`

```python
def __init__(identifier: str, endpoint: str)
```

### exception `ResourceConflictError`

```python
class ResourceConflictError(HubApiError, ValueError)
```

Raised when an operation conflicts with an existing resource.

### exception `ResourceNotFoundError`

```python
class ResourceNotFoundError(HubApiError, LookupError)
```

Raised when a requested HubAI resource cannot be resolved.

Attributes

| Name | Description |
| --- | --- |
| `endpoint` | API resource collection that was searched. |
| `identifier` | ID, raw slug, or resource path that could not be resolved. |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/errors.md) |  |

#### method `__init__`

```python
def __init__(identifier: str, endpoint: str)
```

### exception `ValidationError`

```python
class ValidationError(HubApiError, ValueError)
```

Raised when HubAI rejects request fields or values.
