hydra.errors module

Top-level error types for the Hydra kernel.

class hydra.errors.DecodingError(value: T)

Bases: Node[str]

An error that occurred during decoding of a term.

TYPE_ = Name(value='hydra.errors.DecodingError')
class hydra.errors.Error

Bases: object

ErrorChecking | ErrorDecoding | ErrorDuplicateBinding | ErrorDuplicateField | ErrorExtraction | ErrorInference | ErrorInvalidLiteral | ErrorOther | ErrorResolution | ErrorUndefinedField | ErrorUndefinedTermVariable | ErrorUntypedTermVariable | ErrorUnexpectedTermVariant | ErrorUnexpectedTypeVariant | ErrorUnification

CHECKING = Name(value='checking')
DECODING = Name(value='decoding')
DUPLICATE_BINDING = Name(value='duplicateBinding')
DUPLICATE_FIELD = Name(value='duplicateField')
EXTRACTION = Name(value='extraction')
INFERENCE = Name(value='inference')
INVALID_LITERAL = Name(value='invalidLiteral')
OTHER = Name(value='other')
RESOLUTION = Name(value='resolution')
TYPE_ = Name(value='hydra.errors.Error')
UNDEFINED_FIELD = Name(value='undefinedField')
UNDEFINED_TERM_VARIABLE = Name(value='undefinedTermVariable')
UNEXPECTED_TERM_VARIANT = Name(value='unexpectedTermVariant')
UNEXPECTED_TYPE_VARIANT = Name(value='unexpectedTypeVariant')
UNIFICATION = Name(value='unification')
UNTYPED_TERM_VARIABLE = Name(value='untypedTermVariable')
class hydra.errors.ErrorChecking(value: T)

Bases: Node[hydra.error.checking.CheckingError]

A type checking error

class hydra.errors.ErrorDecoding(value: T)

Bases: Node[DecodingError]

An error that occurred during decoding of a term

class hydra.errors.ErrorDuplicateBinding(value: T)

Bases: Node[hydra.error.core.DuplicateBindingError]

A duplicate binding name error

class hydra.errors.ErrorDuplicateField(value: T)

Bases: Node[hydra.error.core.DuplicateFieldError]

A duplicate field name error

class hydra.errors.ErrorExtraction(value: T)

Bases: Node[ExtractionError]

An error that occurred while extracting a value from a term

class hydra.errors.ErrorInference(value: T)

Bases: Node[InferenceError]

A type inference error

class hydra.errors.ErrorInvalidLiteral(value: T)

Bases: Node[hydra.error.core.InvalidLiteralError]

A literal value validation error

class hydra.errors.ErrorOther(value: T)

Bases: Node[OtherError]

Any other error

class hydra.errors.ErrorResolution(value: T)

Bases: Node[ResolutionError]

A name-resolution error

class hydra.errors.ErrorUndefinedField(value: T)

Bases: Node[hydra.error.core.UndefinedFieldError]

A reference to an undefined field

class hydra.errors.ErrorUndefinedTermVariable(value: T)

Bases: Node[hydra.error.core.UndefinedTermVariableError]

A reference to an undefined term variable

class hydra.errors.ErrorUnexpectedTermVariant(value: T)

Bases: Node[hydra.error.core.UnexpectedTermVariantError]

An unexpected term variant

class hydra.errors.ErrorUnexpectedTypeVariant(value: T)

Bases: Node[hydra.error.core.UnexpectedTypeVariantError]

An unexpected type variant

class hydra.errors.ErrorUnification(value: T)

Bases: Node[UnificationError]

A type unification error

class hydra.errors.ErrorUntypedTermVariable(value: T)

Bases: Node[hydra.error.core.UntypedTermVariableError]

A term variable whose type is not known

class hydra.errors.ExtractionError

Bases: object

ExtractionErrorEmptyList | ExtractionErrorMultipleBindings | ExtractionErrorMultipleFields | ExtractionErrorNoMatchingField | ExtractionErrorNoSuchBinding | ExtractionErrorNotEnoughCases | ExtractionErrorUnexpectedShape

EMPTY_LIST = Name(value='emptyList')
MULTIPLE_BINDINGS = Name(value='multipleBindings')
MULTIPLE_FIELDS = Name(value='multipleFields')
NOT_ENOUGH_CASES = Name(value='notEnoughCases')
NO_MATCHING_FIELD = Name(value='noMatchingField')
NO_SUCH_BINDING = Name(value='noSuchBinding')
TYPE_ = Name(value='hydra.errors.ExtractionError')
UNEXPECTED_SHAPE = Name(value='unexpectedShape')
class hydra.errors.ExtractionErrorEmptyList(value: T)

Bases: Node[EmptyListError]

An empty list was encountered where a non-empty list was required

class hydra.errors.ExtractionErrorMultipleBindings(value: T)

Bases: Node[MultipleBindingsError]

Multiple let bindings were found with the same name

class hydra.errors.ExtractionErrorMultipleFields(value: T)

Bases: Node[MultipleFieldsError]

Multiple record fields were found with the same field name

class hydra.errors.ExtractionErrorNoMatchingField(value: T)

Bases: Node[NoMatchingFieldError]

No field with the expected name was found in a record

class hydra.errors.ExtractionErrorNoSuchBinding(value: T)

Bases: Node[NoSuchBindingError]

No let binding with the expected name was found

class hydra.errors.ExtractionErrorNotEnoughCases(value: T)

Bases: Node[NotEnoughCasesError]

A case statement did not contain enough cases to match the target

class hydra.errors.ExtractionErrorUnexpectedShape(value: T)

Bases: Node[UnexpectedShapeError]

A term, type, literal, or other value had an unexpected shape

class hydra.errors.InferenceError

Bases: object

InferenceErrorChecking | InferenceErrorOther | InferenceErrorUnification

CHECKING = Name(value='checking')
OTHER = Name(value='other')
TYPE_ = Name(value='hydra.errors.InferenceError')
UNIFICATION = Name(value='unification')
class hydra.errors.InferenceErrorChecking(value: T)

Bases: Node[hydra.error.checking.CheckingError]

A type checking error encountered during inference

class hydra.errors.InferenceErrorOther(value: T)

Bases: Node[OtherInferenceError]

A generic inference error carrying a message and a subterm path. Placeholder arm; sites should migrate to typed variants.

class hydra.errors.InferenceErrorUnification(value: T)

Bases: Node[UnificationInferenceError]

A unification failure encountered while inferring types

class hydra.errors.MultipleBindingsError(name: Annotated[Name, 'The binding name which was duplicated'])

Bases: object

Multiple let bindings with the same name were found.

class Builder(_name: 'hydra.core.Name' = None)

Bases: object

build()
name(name)
NAME = Name(value='name')
TYPE_ = Name(value='hydra.errors.MultipleBindingsError')
static builder()
name: Annotated[Name, 'The binding name which was duplicated']
with_name(name)
class hydra.errors.MultipleFieldsError(field_name: Annotated[Name, 'The field name which appeared more than once'])

Bases: object

Multiple fields with the same name were found in a record.

class Builder(_field_name: 'hydra.core.Name' = None)

Bases: object

build()
field_name(field_name)
FIELD_NAME = Name(value='fieldName')
TYPE_ = Name(value='hydra.errors.MultipleFieldsError')
static builder()
field_name: Annotated[Name, 'The field name which appeared more than once']
with_field_name(field_name)
class hydra.errors.NoMatchingFieldError(field_name: Annotated[Name, 'The field name which was not found'])

Bases: object

No field with the expected name was present.

class Builder(_field_name: 'hydra.core.Name' = None)

Bases: object

build()
field_name(field_name)
FIELD_NAME = Name(value='fieldName')
TYPE_ = Name(value='hydra.errors.NoMatchingFieldError')
static builder()
field_name: Annotated[Name, 'The field name which was not found']
with_field_name(field_name)
class hydra.errors.NoSuchBindingError(name: Annotated[Name, 'The binding name which was not found'])

Bases: object

No let binding with the expected name was present.

class Builder(_name: 'hydra.core.Name' = None)

Bases: object

build()
name(name)
NAME = Name(value='name')
TYPE_ = Name(value='hydra.errors.NoSuchBindingError')
static builder()
name: Annotated[Name, 'The binding name which was not found']
with_name(name)
class hydra.errors.NoSuchPrimitiveError(name: Annotated[Name, 'The primitive name which was not found'])

Bases: object

No primitive function with the expected name was registered in the graph.

class Builder(_name: 'hydra.core.Name' = None)

Bases: object

build()
name(name)
NAME = Name(value='name')
TYPE_ = Name(value='hydra.errors.NoSuchPrimitiveError')
static builder()
name: Annotated[Name, 'The primitive name which was not found']
with_name(name)
class hydra.errors.OtherError(value: T)

Bases: Node[str]

Any other error.

TYPE_ = Name(value='hydra.errors.OtherError')
class hydra.errors.OtherInferenceError(path: Annotated[SubtermPath, 'The subterm path at which the error was observed'], message: Annotated[str, 'A human-readable error message'])

Bases: object

A generic inference error: message + subterm path.

class Builder(_path: 'hydra.paths.SubtermPath' = None, _message: 'str' = None)

Bases: object

build()
message(message)
path(path)
MESSAGE = Name(value='message')
PATH = Name(value='path')
TYPE_ = Name(value='hydra.errors.OtherInferenceError')
static builder()
message: Annotated[str, 'A human-readable error message']
path: Annotated[SubtermPath, 'The subterm path at which the error was observed']
with_message(message)
with_path(path)
class hydra.errors.OtherResolutionError(value: T)

Bases: Node[str]

A generic resolution error: message.

TYPE_ = Name(value='hydra.errors.OtherResolutionError')
class hydra.errors.ResolutionError

Bases: object

ResolutionErrorNoSuchBinding | ResolutionErrorNoSuchPrimitive | ResolutionErrorNoMatchingField | ResolutionErrorOther | ResolutionErrorUnexpectedShape

NO_MATCHING_FIELD = Name(value='noMatchingField')
NO_SUCH_BINDING = Name(value='noSuchBinding')
NO_SUCH_PRIMITIVE = Name(value='noSuchPrimitive')
OTHER = Name(value='other')
TYPE_ = Name(value='hydra.errors.ResolutionError')
UNEXPECTED_SHAPE = Name(value='unexpectedShape')
class hydra.errors.ResolutionErrorNoMatchingField(value: T)

Bases: Node[NoMatchingFieldError]

No field with the expected name was present in a record or case statement

class hydra.errors.ResolutionErrorNoSuchBinding(value: T)

Bases: Node[NoSuchBindingError]

No binding with the expected name was found in the graph

class hydra.errors.ResolutionErrorNoSuchPrimitive(value: T)

Bases: Node[NoSuchPrimitiveError]

No primitive function with the expected name was found in the graph

class hydra.errors.ResolutionErrorOther(value: T)

Bases: Node[OtherResolutionError]

A generic resolution error carrying a message

class hydra.errors.ResolutionErrorUnexpectedShape(value: T)

Bases: Node[UnexpectedShapeError]

A term had a shape other than the one expected (e.g. a record, an injection)

class hydra.errors.UnexpectedShapeError(expected: Annotated[str, 'A description of the expected shape'], actual: Annotated[str, 'A description of the shape actually encountered'])

Bases: object

A term, type, literal, or related value had a shape other than the one expected.

ACTUAL = Name(value='actual')
class Builder(_expected: 'str' = None, _actual: 'str' = None)

Bases: object

actual(actual)
build()
expected(expected)
EXPECTED = Name(value='expected')
TYPE_ = Name(value='hydra.errors.UnexpectedShapeError')
actual: Annotated[str, 'A description of the shape actually encountered']
static builder()
expected: Annotated[str, 'A description of the expected shape']
with_actual(actual)
with_expected(expected)
class hydra.errors.UnificationError(left_type: Annotated[Type, 'The left-hand type in the unification'], right_type: Annotated[Type, 'The right-hand type in the unification'], message: Annotated[str, 'A human-readable error message'])

Bases: object

An error that occurred during type unification.

class Builder(_left_type: 'hydra.core.Type' = None, _right_type: 'hydra.core.Type' = None, _message: 'str' = None)

Bases: object

build()
left_type(left_type)
message(message)
right_type(right_type)
LEFT_TYPE = Name(value='leftType')
MESSAGE = Name(value='message')
RIGHT_TYPE = Name(value='rightType')
TYPE_ = Name(value='hydra.errors.UnificationError')
static builder()
left_type: Annotated[Type, 'The left-hand type in the unification']
message: Annotated[str, 'A human-readable error message']
right_type: Annotated[Type, 'The right-hand type in the unification']
with_left_type(left_type)
with_message(message)
with_right_type(right_type)
class hydra.errors.UnificationInferenceError(path: Annotated[SubtermPath, 'The subterm path at which the unification failure was observed'], cause: Annotated[UnificationError, 'The underlying unification error'])

Bases: object

A unification failure at a specific subterm locus during inference.

class Builder(_path: 'hydra.paths.SubtermPath' = None, _cause: 'UnificationError' = None)

Bases: object

build()
cause(cause)
path(path)
CAUSE = Name(value='cause')
PATH = Name(value='path')
TYPE_ = Name(value='hydra.errors.UnificationInferenceError')
static builder()
cause: Annotated[UnificationError, 'The underlying unification error']
path: Annotated[SubtermPath, 'The subterm path at which the unification failure was observed']
with_cause(cause)
with_path(path)