Skip to content

Exceptions

ZenML specific exception definitions.

ArtifactStoreInterfaceError

Bases: ZenMLBaseException

Raises exception when interacting with the Artifact Store interface in an unsupported way.

Source code in src/zenml/exceptions.py
89
90
class ArtifactStoreInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Artifact Store interface in an unsupported way."""

AuthorizationException

Bases: ZenMLBaseException

Raised when an authorization error occurred while trying to access a ZenML resource .

Source code in src/zenml/exceptions.py
46
47
class AuthorizationException(ZenMLBaseException):
    """Raised when an authorization error occurred while trying to access a ZenML resource ."""

BackupSecretsStoreNotConfiguredError

Bases: NotImplementedError

Raised when a backup secrets store is not configured.

Source code in src/zenml/exceptions.py
213
214
class BackupSecretsStoreNotConfiguredError(NotImplementedError):
    """Raised when a backup secrets store is not configured."""

CredentialsNotValid

Bases: AuthorizationException

Raised when the credentials provided are invalid.

This is a subclass of AuthorizationException and should only be raised when the authentication credentials are invalid (e.g. expired API token, invalid username/password, invalid signature). If caught by the ZenML client, it will trigger an invalidation of the currently cached API token and a re-authentication flow.

Source code in src/zenml/exceptions.py
50
51
52
53
54
55
56
57
58
class CredentialsNotValid(AuthorizationException):
    """Raised when the credentials provided are invalid.

    This is a subclass of AuthorizationException and should only be raised when
    the authentication credentials are invalid (e.g. expired API token, invalid
    username/password, invalid signature). If caught by the ZenML client, it
    will trigger an invalidation of the currently cached API token and a
    re-authentication flow.
    """

CustomFlavorImportError

Bases: ImportError

Raised when failing to import a custom flavor.

Source code in src/zenml/exceptions.py
217
218
class CustomFlavorImportError(ImportError):
    """Raised when failing to import a custom flavor."""

DoesNotExistException

Bases: ZenMLBaseException

Raises exception when the entity does not exist in the system but an action is being done that requires it to be present.

Source code in src/zenml/exceptions.py
61
62
63
64
65
66
67
68
69
70
class DoesNotExistException(ZenMLBaseException):
    """Raises exception when the entity does not exist in the system but an action is being done that requires it to be present."""

    def __init__(self, message: str):
        """Initializes the exception.

        Args:
            message: Message with details of exception.
        """
        super().__init__(message)

__init__(message)

Initializes the exception.

Parameters:

Name Type Description Default
message str

Message with details of exception.

required
Source code in src/zenml/exceptions.py
64
65
66
67
68
69
70
def __init__(self, message: str):
    """Initializes the exception.

    Args:
        message: Message with details of exception.
    """
    super().__init__(message)

EntityCreationError

Bases: ZenMLBaseException, RuntimeError

Raised when failing to create an entity.

Source code in src/zenml/exceptions.py
105
106
class EntityCreationError(ZenMLBaseException, RuntimeError):
    """Raised when failing to create an entity."""

EntityExistsError

Bases: ZenMLBaseException

Raised when trying to register an entity that already exists.

Source code in src/zenml/exceptions.py
101
102
class EntityExistsError(ZenMLBaseException):
    """Raised when trying to register an entity that already exists."""

GitNotFoundError

Bases: ImportError

Raised when ZenML CLI is used to interact with examples on a machine with no git installation.

Source code in src/zenml/exceptions.py
117
118
class GitNotFoundError(ImportError):
    """Raised when ZenML CLI is used to interact with examples on a machine with no git installation."""

HydrationError

Bases: ZenMLBaseException

Raised when the model hydration failed.

Source code in src/zenml/exceptions.py
141
142
class HydrationError(ZenMLBaseException):
    """Raised when the model hydration failed."""

IllegalOperationError

Bases: ZenMLBaseException

Raised when an illegal operation is attempted.

Source code in src/zenml/exceptions.py
121
122
class IllegalOperationError(ZenMLBaseException):
    """Raised when an illegal operation is attempted."""

InitializationException

Bases: ZenMLBaseException

Raised when an error occurred during initialization of a ZenML repository.

Source code in src/zenml/exceptions.py
42
43
class InitializationException(ZenMLBaseException):
    """Raised when an error occurred during initialization of a ZenML repository."""

InputResolutionError

Bases: ZenMLBaseException

Raised when step input resolving failed.

Source code in src/zenml/exceptions.py
133
134
class InputResolutionError(ZenMLBaseException):
    """Raised when step input resolving failed."""

IntegrationError

Bases: ZenMLBaseException

Raises exceptions when a requested integration can not be activated.

Source code in src/zenml/exceptions.py
93
94
class IntegrationError(ZenMLBaseException):
    """Raises exceptions when a requested integration can not be activated."""

MaterializerInterfaceError

Bases: ZenMLBaseException

Raises exception when interacting with the Materializer interface in an unsupported way.

Source code in src/zenml/exceptions.py
77
78
class MaterializerInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Materializer interface in an unsupported way."""

MethodNotAllowedError

Bases: ZenMLBaseException

Raised when the server does not allow a request method.

Source code in src/zenml/exceptions.py
125
126
class MethodNotAllowedError(ZenMLBaseException):
    """Raised when the server does not allow a request method."""

OAuthError

Bases: ValueError

OAuth2 error.

Source code in src/zenml/exceptions.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
class OAuthError(ValueError):
    """OAuth2 error."""

    def __init__(
        self,
        error: str,
        status_code: int = 400,
        error_description: Optional[str] = None,
        error_uri: Optional[str] = None,
    ) -> None:
        """Initializes the OAuthError.

        Args:
            status_code: HTTP status code.
            error: Error code.
            error_description: Error description.
            error_uri: Error URI.
        """
        self.status_code = status_code
        self.error = error
        self.error_description = error_description
        self.error_uri = error_uri

    def to_dict(self) -> Dict[str, Optional[str]]:
        """Returns the OAuthError as a dictionary.

        Returns:
            The OAuthError as a dictionary.
        """
        return {
            "error": self.error,
            "error_description": self.error_description,
            "error_uri": self.error_uri,
        }

    def __str__(self) -> str:
        """String function.

        Returns:
            the error message
        """
        return f"{self.error}: {self.error_description or ''}"

__init__(error, status_code=400, error_description=None, error_uri=None)

Initializes the OAuthError.

Parameters:

Name Type Description Default
status_code int

HTTP status code.

400
error str

Error code.

required
error_description Optional[str]

Error description.

None
error_uri Optional[str]

Error URI.

None
Source code in src/zenml/exceptions.py
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
def __init__(
    self,
    error: str,
    status_code: int = 400,
    error_description: Optional[str] = None,
    error_uri: Optional[str] = None,
) -> None:
    """Initializes the OAuthError.

    Args:
        status_code: HTTP status code.
        error: Error code.
        error_description: Error description.
        error_uri: Error URI.
    """
    self.status_code = status_code
    self.error = error
    self.error_description = error_description
    self.error_uri = error_uri

__str__()

String function.

Returns:

Type Description
str

the error message

Source code in src/zenml/exceptions.py
200
201
202
203
204
205
206
def __str__(self) -> str:
    """String function.

    Returns:
        the error message
    """
    return f"{self.error}: {self.error_description or ''}"

to_dict()

Returns the OAuthError as a dictionary.

Returns:

Type Description
Dict[str, Optional[str]]

The OAuthError as a dictionary.

Source code in src/zenml/exceptions.py
188
189
190
191
192
193
194
195
196
197
198
def to_dict(self) -> Dict[str, Optional[str]]:
    """Returns the OAuthError as a dictionary.

    Returns:
        The OAuthError as a dictionary.
    """
    return {
        "error": self.error,
        "error_description": self.error_description,
        "error_uri": self.error_uri,
    }

SecretsStoreNotConfiguredError

Bases: NotImplementedError

Raised when a secrets store is not configured.

Source code in src/zenml/exceptions.py
209
210
class SecretsStoreNotConfiguredError(NotImplementedError):
    """Raised when a secrets store is not configured."""

SettingsResolvingError

Bases: ZenMLBaseException

Raised when resolving settings failed.

Source code in src/zenml/exceptions.py
129
130
class SettingsResolvingError(ZenMLBaseException):
    """Raised when resolving settings failed."""

StackComponentInterfaceError

Bases: ZenMLBaseException

Raises exception when interacting with the stack components in an unsupported way.

Source code in src/zenml/exceptions.py
85
86
class StackComponentInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the stack components in an unsupported way."""

StackValidationError

Bases: ZenMLBaseException

Raised when a stack configuration is not valid.

Source code in src/zenml/exceptions.py
113
114
class StackValidationError(ZenMLBaseException):
    """Raised when a stack configuration is not valid."""

StepContextError

Bases: ZenMLBaseException

Raises exception when interacting with a StepContext in an unsupported way.

Source code in src/zenml/exceptions.py
81
82
class StepContextError(ZenMLBaseException):
    """Raises exception when interacting with a StepContext in an unsupported way."""

StepInterfaceError

Bases: ZenMLBaseException

Raises exception when interacting with the Step interface in an unsupported way.

Source code in src/zenml/exceptions.py
73
74
class StepInterfaceError(ZenMLBaseException):
    """Raises exception when interacting with the Step interface in an unsupported way."""

SubscriptionUpgradeRequiredError

Bases: ZenMLBaseException

Raised when user tries to perform an action outside their current subscription tier.

Source code in src/zenml/exceptions.py
137
138
class SubscriptionUpgradeRequiredError(ZenMLBaseException):
    """Raised when user tries to perform an action outside their current subscription tier."""

ValidationError

Bases: ZenMLBaseException

Raised when the Model passed to the ZenStore.

Source code in src/zenml/exceptions.py
97
98
class ValidationError(ZenMLBaseException):
    """Raised when the Model passed to the ZenStore."""

WebhookInactiveError

Bases: ZenMLBaseException

Raised when source is inactive.

Source code in src/zenml/exceptions.py
109
110
class WebhookInactiveError(ZenMLBaseException):
    """Raised when source is inactive."""

ZenKeyError

Bases: KeyError

Specialized key error which allows error messages with line breaks.

Source code in src/zenml/exceptions.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
class ZenKeyError(KeyError):
    """Specialized key error which allows error messages with line breaks."""

    def __init__(self, message: str) -> None:
        """Initialization.

        Args:
            message:str, the error message
        """
        self.message = message

    def __str__(self) -> str:
        """String function.

        Returns:
            the error message
        """
        return self.message

__init__(message)

Initialization.

Parameters:

Name Type Description Default
message str

str, the error message

required
Source code in src/zenml/exceptions.py
148
149
150
151
152
153
154
def __init__(self, message: str) -> None:
    """Initialization.

    Args:
        message:str, the error message
    """
    self.message = message

__str__()

String function.

Returns:

Type Description
str

the error message

Source code in src/zenml/exceptions.py
156
157
158
159
160
161
162
def __str__(self) -> str:
    """String function.

    Returns:
        the error message
    """
    return self.message

ZenMLBaseException

Bases: Exception

Base exception for all ZenML Exceptions.

Source code in src/zenml/exceptions.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class ZenMLBaseException(Exception):
    """Base exception for all ZenML Exceptions."""

    def __init__(
        self,
        message: Optional[str] = None,
        url: Optional[str] = None,
    ):
        """The BaseException used to format messages displayed to the user.

        Args:
            message: Message with details of exception. This message
                     will be appended with another message directing user to
                     `url` for more information. If `None`, then default
                     Exception behavior is used.
            url: URL to point to in exception message. If `None`, then no url
                 is appended.
        """
        if message and url:
            message += f" For more information, visit {url}."
        super().__init__(message)

__init__(message=None, url=None)

The BaseException used to format messages displayed to the user.

Parameters:

Name Type Description Default
message Optional[str]

Message with details of exception. This message will be appended with another message directing user to url for more information. If None, then default Exception behavior is used.

None
url Optional[str]

URL to point to in exception message. If None, then no url is appended.

None
Source code in src/zenml/exceptions.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def __init__(
    self,
    message: Optional[str] = None,
    url: Optional[str] = None,
):
    """The BaseException used to format messages displayed to the user.

    Args:
        message: Message with details of exception. This message
                 will be appended with another message directing user to
                 `url` for more information. If `None`, then default
                 Exception behavior is used.
        url: URL to point to in exception message. If `None`, then no url
             is appended.
    """
    if message and url:
        message += f" For more information, visit {url}."
    super().__init__(message)