Exceptions

ExceptionContext

class encord.exceptions.ExceptionContext(timestamp=<factory>)

timestamp: str

@dataclass
class ExceptionContext:
    timestamp: str = field(default_factory=lambda: datetime.now(tz=timezone.utc).isoformat())

    def __str__(self):
        return " ".join(
            f"{object_field.name}={getattr(self, object_field.name)!r}"
            for object_field in fields(self)
            if getattr(self, object_field.name) is not None
        )

EncordException

exception encord.exceptions.EncordException(message, context=None)

Base class for all exceptions.

class EncordException(Exception):
    """Base class for all exceptions."""

    def __init__(self, message: str, context: Optional[ExceptionContext] = None):
        super().__init__(message)
        self.message = message
        self.context = context if context is not None else ExceptionContext()

    def __str__(self):
        return f"{self.message} {self.context}"

CordException

encord.exceptions.CordException

alias of encord.exceptions.EncordException


InitialisationError

exception encord.exceptions.InitialisationError(message, context=None)

Exception thrown when API key fails to initialise.

class InitialisationError(EncordException):
    """Exception thrown when API key fails to initialise."""

    pass

AuthenticationError

exception encord.exceptions.AuthenticationError(message, context=None)

Exception thrown when API key fails authentication.

class AuthenticationError(EncordException):
    """Exception thrown when API key fails authentication."""

    pass

AuthorisationError

exception encord.exceptions.AuthorisationError(message, context=None)

Exception thrown when access is unauthorised. (E.g. access to a data asset or method).

class AuthorisationError(EncordException):
    """
    Exception thrown when access is unauthorised.
    (E.g. access to a data asset or method).
    """

    pass

ResourceNotFoundError

exception encord.exceptions.ResourceNotFoundError(message, context=None)

Exception thrown when a requested resource is not found. (E.g. label, data asset).

class ResourceNotFoundError(EncordException):
    """
    Exception thrown when a requested resource is not found.
    (E.g. label, data asset).
    """

    pass

TimeOutError

exception encord.exceptions.TimeOutError(message, context=None)

Exception thrown when a request times out.

class TimeOutError(EncordException):
    """Exception thrown when a request times out."""

    pass

RequestException

exception encord.exceptions.RequestException(message, context=None)

Ambiguous exception while handling request.

class RequestException(EncordException):
    """Ambiguous exception while handling request."""

    pass

UnknownException

exception encord.exceptions.UnknownException(message, context=None)

Unknown error.

class UnknownException(EncordException):
    """Unknown error."""

    pass

InvalidDateFormatError

exception encord.exceptions.InvalidDateFormatError(message, context=None)

Invalid date format error

class InvalidDateFormatError(EncordException):
    """Invalid date format error"""

    pass

MethodNotAllowedError

exception encord.exceptions.MethodNotAllowedError(message, context=None)

Exception thrown when HTTP method is not allowed.

class MethodNotAllowedError(EncordException):
    """Exception thrown when HTTP method is not allowed."""

    pass

OperationNotAllowed

exception encord.exceptions.OperationNotAllowed(message, context=None)

Exception thrown when a read/write operation is not allowed. The API key blocks the operation.

class OperationNotAllowed(EncordException):
    """
    Exception thrown when a read/write operation is not allowed.
    The API key blocks the operation.
    """

    pass

AnswerDictionaryError

exception encord.exceptions.AnswerDictionaryError(message, context=None)

Exception thrown when answer dictionaries are incomplete. Occurs when an object or classification is missing.

class AnswerDictionaryError(EncordException):
    """
    Exception thrown when answer dictionaries are incomplete.
    Occurs when an object or classification is missing.
    """

    pass

CorruptedLabelError

Exception thrown when a label is corrupted. (E.g. the frame labels have more frames than the video).

exception encord.exceptions.CorruptedLabelError(message, context=None)
class CorruptedLabelError(EncordException):
    """
    Exception thrown when a label is corrupted.
    (E.g. the frame labels have more frames than the video).
    """

    pass

FileTypeNotSupportedError

exception encord.exceptions.FileTypeNotSupportedError(message, context=None)

Exception thrown when a file type is not supported. Supported file types are: image/jpeg, image/png, video/webm, video/mp4.

class FileTypeNotSupportedError(EncordException):
    """
    Exception thrown when a file type is not supported.
    Supported file types are: image/jpeg, image/png, video/webm, video/mp4.
    """

    pass

FileSizeNotSupportedError

exception encord.exceptions.FileSizeNotSupportedError(message, context=None)

Exception thrown when the combined size of the input files is larger than the supported limit.

class FileSizeNotSupportedError(EncordException):
    """
    Exception thrown when the combined size of the input files is larger than the supported limit.
    """

    pass

FeatureDoesNotExistError

class FeatureDoesNotExistError(EncordException):

If a feature uid does not exist in a given project ontology.

class FeatureDoesNotExistError(EncordException):
    """
    If a feature uid does not exist in a given project ontology.
    """

    pass

ModelWeightsInconsistentError

exception encord.exceptions.ModelWeightsInconsistentError(message, context=None)

Exception thrown when an attempted model training iteration has a different type of weights than what is recorded (i.e. if type of model_hash (uid) is faster_rcnn, but is attempted trained with different model weights).

class ModelWeightsInconsistentError(EncordException):
    """
    Exception thrown when an attempted model training iteration has a different
    type of weights than what is recorded (i.e. if type of model_hash (uid) is faster_rcnn,
    but is attempted trained with different model weights).
    """

    pass

ModelFeaturesInconsistentError

exception encord.exceptions.ModelFeaturesInconsistentError(message, context=None)

If a feature type is different than what is supported by the model (e.g. if creating a classification model using a bounding box).

class ModelFeaturesInconsistentError(EncordException):
    """
    If a feature type is different than what is supported by the model (e.g. if
    creating a classification model using a bounding box).
    """

    pass

UploadOperationNotSupportedError

class UploadOperationNotSupportedError(EncordException):

Exception thrown when trying to upload a video/image group to non-Encord storage dataset

class UploadOperationNotSupportedError(EncordException):
    """Exception thrown when trying to upload a video/image group to non-Encord storage dataset"""

    pass

DetectionRangeInvalidError

exception encord.exceptions.DetectionRangeInvalidError(message, context=None)

Exception thrown when a detection range is invalid. (E.g. negative, or higher than the number of frames in the video).

class DetectionRangeInvalidError(EncordException):
    """
    Exception thrown when a detection range is invalid.
    (E.g. negative or higher than num frames in video).
    """

    pass

InvalidAlgorithmError

exception encord.exceptions.InvalidAlgorithmError(message, context=None)

Exception thrown when invalid labeling algorithm name is sent.

class InvalidAlgorithmError(EncordException):
    """Exception thrown when invalid labeling algorithm name is sent."""

    pass

ResourceExistsError

exception encord.exceptions.ResourceExistsError(message, context=None)

Exception thrown when trying create a resource that already exists. Avoids overriding existing work.

class ResourceExistsError(EncordException):
    """
    Exception thrown when trying to re-create a resource.
    Avoids overriding existing work.
    """

    pass

DuplicateSshKeyError

exception encord.exceptions.DuplicateSshKeyError(message, context=None)

Exception thrown when using an SSH key that was added to the platform twice.

class DuplicateSshKeyError(EncordException):
    """
    Exception thrown when using an SSH key that was added twice to the platform.
    """

    pass

SshKeyNotFound

exception encord.exceptions.SshKeyNotFound(message, context=None)

Exception thrown when using an SSH key that was not added to the platform.

class SshKeyNotFound(EncordException):
    """
    Exception thrown when using an SSH key that was not added to the platform.
    """

InvalidArgumentsError

exception encord.exceptions.InvalidArgumentsError(message, context=None)

Exception thrown when the arguments are invalid.

class InvalidArgumentsError(EncordException):
    """Exception thrown when the arguments are invalid."""

    pass

GenericServerError

exception encord.exceptions.GenericServerError(message, context=None)

The server has reported an error which is not recognised by this SDK version. Try upgrading the SDK version to see the precise error that is reported.

class GenericServerError(EncordException):
    """
    The server has reported an error which is not recognised by this SDK version. Try upgrading the SDK version to
    see the precise error that is reported.
    """

    pass

CloudUploadError

exception encord.exceptions.CloudUploadError(message, context=None)

The upload to the cloud was not successful

class CloudUploadError(EncordException):
    """
    The upload to the cloud was not successful
    """

    pass

MultiLabelLimitError

exception encord.exceptions.MultiLabelLimitError(message, maximum_labels_allowed, context=None)

Too many labels were requested

class MultiLabelLimitError(EncordException):
    """
    Too many labels were requested
    """

    def __init__(self, message, maximum_labels_allowed: int, context: Optional[ExceptionContext] = None):
        super().__init__(message=message, context=context)
        self.maximum_labels_allowed = maximum_labels_allowed


LabelRowError

exception encord.exceptions.LabelRowError(message, context=None)

An error thrown when the construction of a LabelRow class is invalid.

class LabelRowError(EncordException):
    """An error thrown when the construction of a LabelRow class is invalid."""

    pass

OntologyError

exception encord.exceptions.OntologyError(message, context=None)

An error thrown when using the ontology class with an error.

class OntologyError(EncordException):
    """An error thrown when using the ontology class with an error."""

    pass


WrongProjectTypeError

exception encord.exceptions.WrongProjectTypeError(message, context=None)

An error thrown when project type does not match the operation E.g. when TMS2 specific operations are attempted on non-TMS2 project

class WrongProjectTypeError(CordException):
    """
    An error thrown when project type does not match the operation
    E.g. when TMS2 specific operations are attempted on non-TMS2 project
    """