Skip to content

Exceptions

exceptions

Exception hierarchy for gepa-adk.

This module defines the exception hierarchy following ADR-009 guidelines. All gepa-adk specific exceptions inherit from EvolutionError.

ATTRIBUTE DESCRIPTION
EvolutionError

Base exception for all gepa-adk errors.

TYPE: class

ConfigurationError

Raised when configuration validation fails.

TYPE: class

Examples:

Handling configuration errors:

from gepa_adk.domain.exceptions import ConfigurationError

try:
    raise ConfigurationError(
        "Invalid value", field="max_iterations", value=-1, constraint=">= 0"
    )
except ConfigurationError as e:
    print(f"Field: {e.field}, Value: {e.value}")
# Output: Field: max_iterations, Value: -1
Note

The exception hierarchy provides structured error handling with contextual information for debugging and error recovery.

EvolutionError

Bases: Exception


              flowchart TD
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

              

              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Base exception for all gepa-adk errors.

All custom exceptions in gepa-adk should inherit from this class to allow for unified exception handling.

Examples:

Catching evolution errors:

from gepa_adk.domain.exceptions import EvolutionError

try:
    raise EvolutionError("Evolution failed unexpectedly")
except EvolutionError as e:
    print(f"Caught: {e}")
# Output: Caught: Evolution failed unexpectedly
Note

Always use this base class or its subclasses for domain errors. Standard Python exceptions should still be raised for programming errors (e.g., TypeError, ValueError for developer mistakes).

Source code in src/gepa_adk/domain/exceptions.py
class EvolutionError(Exception):
    """Base exception for all gepa-adk errors.

    All custom exceptions in gepa-adk should inherit from this class
    to allow for unified exception handling.

    Examples:
        Catching evolution errors:

        ```python
        from gepa_adk.domain.exceptions import EvolutionError

        try:
            raise EvolutionError("Evolution failed unexpectedly")
        except EvolutionError as e:
            print(f"Caught: {e}")
        # Output: Caught: Evolution failed unexpectedly
        ```

    Note:
        Always use this base class or its subclasses for domain errors.
        Standard Python exceptions should still be raised for programming
        errors (e.g., TypeError, ValueError for developer mistakes).
    """

ConfigurationError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.ConfigurationError[ConfigurationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigurationError
                


              click gepa_adk.domain.exceptions.ConfigurationError href "" "gepa_adk.domain.exceptions.ConfigurationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when configuration validation fails.

This exception is raised during EvolutionConfig initialization when a parameter violates its validation constraints.

ATTRIBUTE DESCRIPTION
field

The name of the configuration field that failed validation.

TYPE: str | None

value

The invalid value that was provided.

TYPE: object

constraint

Description of the validation constraint that was violated.

TYPE: str | None

Examples:

Creating a configuration error with context:

from gepa_adk.domain.exceptions import ConfigurationError

error = ConfigurationError(
    "max_iterations must be non-negative",
    field="max_iterations",
    value=-5,
    constraint=">= 0",
)
print(error.field, error.value, error.constraint)
# Output: max_iterations -5 >= 0
Note

Arises from user-provided invalid settings, not programming errors. Should be caught and reported with clear guidance on valid values.

Source code in src/gepa_adk/domain/exceptions.py
class ConfigurationError(EvolutionError):
    """Raised when configuration validation fails.

    This exception is raised during EvolutionConfig initialization
    when a parameter violates its validation constraints.

    Attributes:
        field (str | None): The name of the configuration field that failed
            validation.
        value (object): The invalid value that was provided.
        constraint (str | None): Description of the validation constraint that
            was violated.

    Examples:
        Creating a configuration error with context:

        ```python
        from gepa_adk.domain.exceptions import ConfigurationError

        error = ConfigurationError(
            "max_iterations must be non-negative",
            field="max_iterations",
            value=-5,
            constraint=">= 0",
        )
        print(error.field, error.value, error.constraint)
        # Output: max_iterations -5 >= 0
        ```

    Note:
        Arises from user-provided invalid settings, not programming errors.
        Should be caught and reported with clear guidance on valid values.
    """

    def __init__(
        self,
        message: str,
        *,
        field: str | None = None,
        value: object = None,
        constraint: str | None = None,
    ) -> None:
        """Initialize ConfigurationError with context.

        Args:
            message: Human-readable error description.
            field: Name of the invalid configuration field.
            value: The invalid value provided.
            constraint: Description of the validation constraint.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.field = field
        self.value = value
        self.constraint = constraint

    def __str__(self) -> str:
        """Return string representation with context.

        Returns:
            Formatted error message including field and value context.

        Note:
            Outputs formatted error message with field and value context
            when available, preserving base message structure.
        """
        base = super().__str__()
        context_parts = []
        if self.field is not None:
            context_parts.append(f"field={self.field!r}")
        if self.value is not None:
            context_parts.append(f"value={self.value!r}")
        if context_parts:
            return f"{base} [{', '.join(context_parts)}]"
        return base

__init__

__init__(
    message: str,
    *,
    field: str | None = None,
    value: object = None,
    constraint: str | None = None,
) -> None

Initialize ConfigurationError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

field

Name of the invalid configuration field.

TYPE: str | None DEFAULT: None

value

The invalid value provided.

TYPE: object DEFAULT: None

constraint

Description of the validation constraint.

TYPE: str | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    field: str | None = None,
    value: object = None,
    constraint: str | None = None,
) -> None:
    """Initialize ConfigurationError with context.

    Args:
        message: Human-readable error description.
        field: Name of the invalid configuration field.
        value: The invalid value provided.
        constraint: Description of the validation constraint.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.field = field
    self.value = value
    self.constraint = constraint

__str__

__str__() -> str

Return string representation with context.

RETURNS DESCRIPTION
str

Formatted error message including field and value context.

Note

Outputs formatted error message with field and value context when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string representation with context.

    Returns:
        Formatted error message including field and value context.

    Note:
        Outputs formatted error message with field and value context
        when available, preserving base message structure.
    """
    base = super().__str__()
    context_parts = []
    if self.field is not None:
        context_parts.append(f"field={self.field!r}")
    if self.value is not None:
        context_parts.append(f"value={self.value!r}")
    if context_parts:
        return f"{base} [{', '.join(context_parts)}]"
    return base

NoCandidateAvailableError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.NoCandidateAvailableError[NoCandidateAvailableError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.NoCandidateAvailableError
                


              click gepa_adk.domain.exceptions.NoCandidateAvailableError href "" "gepa_adk.domain.exceptions.NoCandidateAvailableError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when no candidates are available for selection.

ATTRIBUTE DESCRIPTION
cause

Original exception that caused this error.

TYPE: Exception | None

context

Extra context (candidate_idx, frontier_type).

TYPE: dict[str, object]

Examples:

raise NoCandidateAvailableError(
    "No candidates available",
    frontier_type="instance",
)
Note

Arises when candidate selector cannot find any valid candidates from the Pareto frontier, typically due to empty frontier or filtering constraints.

Source code in src/gepa_adk/domain/exceptions.py
class NoCandidateAvailableError(EvolutionError):
    """Raised when no candidates are available for selection.

    Attributes:
        cause (Exception | None): Original exception that caused this error.
        context (dict[str, object]): Extra context (candidate_idx, frontier_type).

    Examples:
        ```python
        raise NoCandidateAvailableError(
            "No candidates available",
            frontier_type="instance",
        )
        ```

    Note:
        Arises when candidate selector cannot find any valid candidates
        from the Pareto frontier, typically due to empty frontier or
        filtering constraints.
    """

    def __init__(
        self,
        message: str,
        *,
        cause: Exception | None = None,
        **context: object,
    ) -> None:
        """Initialize NoCandidateAvailableError with context.

        Args:
            message: Human-readable error description.
            cause: Original exception that caused this error.
            **context: Additional context such as candidate_idx or frontier_type.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.cause = cause
        self.context = context

    def __str__(self) -> str:
        """Return string with context and cause details.

        Returns:
            Formatted error message including context and cause information.

        Note:
            Outputs formatted error message with context dict and cause chain
            when available, preserving base message structure.
        """
        base = super().__str__()
        if self.context:
            ctx_str = ", ".join(f"{k}={v!r}" for k, v in self.context.items())
            base = f"{base} [{ctx_str}]"
        if self.cause:
            base = f"{base} (caused by: {self.cause})"
        return base

__init__

__init__(
    message: str,
    *,
    cause: Exception | None = None,
    **context: object,
) -> None

Initialize NoCandidateAvailableError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

**context

Additional context such as candidate_idx or frontier_type.

TYPE: object DEFAULT: {}

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    cause: Exception | None = None,
    **context: object,
) -> None:
    """Initialize NoCandidateAvailableError with context.

    Args:
        message: Human-readable error description.
        cause: Original exception that caused this error.
        **context: Additional context such as candidate_idx or frontier_type.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.cause = cause
    self.context = context

__str__

__str__() -> str

Return string with context and cause details.

RETURNS DESCRIPTION
str

Formatted error message including context and cause information.

Note

Outputs formatted error message with context dict and cause chain when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with context and cause details.

    Returns:
        Formatted error message including context and cause information.

    Note:
        Outputs formatted error message with context dict and cause chain
        when available, preserving base message structure.
    """
    base = super().__str__()
    if self.context:
        ctx_str = ", ".join(f"{k}={v!r}" for k, v in self.context.items())
        base = f"{base} [{ctx_str}]"
    if self.cause:
        base = f"{base} (caused by: {self.cause})"
    return base

EvaluationError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
                


              click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when batch evaluation fails.

This exception indicates failures during agent evaluation, such as agent execution errors, timeout, or malformed output.

ATTRIBUTE DESCRIPTION
cause

Original exception that caused this error.

TYPE: Exception | None

context

Additional context for debugging.

TYPE: dict

Examples:

Wrapping an ADK error:

from gepa_adk.domain.exceptions import EvaluationError

try:
    result = await runner.run_async(...)
except ADKError as e:
    raise EvaluationError(
        "Agent execution failed",
        cause=e,
        agent_name="my_agent",
    ) from e
Note

Always preserves the original cause for debugging while providing a consistent interface for error handling.

Source code in src/gepa_adk/domain/exceptions.py
class EvaluationError(EvolutionError):
    """Raised when batch evaluation fails.

    This exception indicates failures during agent evaluation,
    such as agent execution errors, timeout, or malformed output.

    Attributes:
        cause (Exception | None): Original exception that caused this error.
        context (dict): Additional context for debugging.

    Examples:
        Wrapping an ADK error:

        ```python
        from gepa_adk.domain.exceptions import EvaluationError

        try:
            result = await runner.run_async(...)
        except ADKError as e:
            raise EvaluationError(
                "Agent execution failed",
                cause=e,
                agent_name="my_agent",
            ) from e
        ```

    Note:
        Always preserves the original cause for debugging while providing
        a consistent interface for error handling.
    """

    def __init__(
        self,
        message: str,
        *,
        cause: Exception | None = None,
        **context: object,
    ) -> None:
        """Initialize EvaluationError with cause and context.

        Args:
            message: Human-readable error description.
            cause: Original exception that caused this error.
            **context: Additional context for debugging (agent_name, etc.).

        Note:
            Context is passed via keyword arguments. Positional arguments
            after message are not allowed.
        """
        super().__init__(message)
        self.cause = cause
        self.context = context

    def __str__(self) -> str:
        """Return string with cause chain if present.

        Returns:
            Formatted message with context and cause information.

        Note:
            Outputs formatted error message with context dict and cause chain
            when available, preserving base message structure.
        """
        base = super().__str__()
        if self.context:
            ctx_str = ", ".join(f"{k}={v!r}" for k, v in self.context.items())
            base = f"{base} [{ctx_str}]"
        if self.cause:
            base = f"{base} (caused by: {self.cause})"
        return base

__init__

__init__(
    message: str,
    *,
    cause: Exception | None = None,
    **context: object,
) -> None

Initialize EvaluationError with cause and context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

**context

Additional context for debugging (agent_name, etc.).

TYPE: object DEFAULT: {}

Note

Context is passed via keyword arguments. Positional arguments after message are not allowed.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    cause: Exception | None = None,
    **context: object,
) -> None:
    """Initialize EvaluationError with cause and context.

    Args:
        message: Human-readable error description.
        cause: Original exception that caused this error.
        **context: Additional context for debugging (agent_name, etc.).

    Note:
        Context is passed via keyword arguments. Positional arguments
        after message are not allowed.
    """
    super().__init__(message)
    self.cause = cause
    self.context = context

__str__

__str__() -> str

Return string with cause chain if present.

RETURNS DESCRIPTION
str

Formatted message with context and cause information.

Note

Outputs formatted error message with context dict and cause chain when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with cause chain if present.

    Returns:
        Formatted message with context and cause information.

    Note:
        Outputs formatted error message with context dict and cause chain
        when available, preserving base message structure.
    """
    base = super().__str__()
    if self.context:
        ctx_str = ", ".join(f"{k}={v!r}" for k, v in self.context.items())
        base = f"{base} [{ctx_str}]"
    if self.cause:
        base = f"{base} (caused by: {self.cause})"
    return base

AdapterError

Bases: EvaluationError


              flowchart TD
              gepa_adk.domain.exceptions.AdapterError[AdapterError]
              gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvaluationError --> gepa_adk.domain.exceptions.AdapterError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
                



              click gepa_adk.domain.exceptions.AdapterError href "" "gepa_adk.domain.exceptions.AdapterError"
              click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when an adapter operation fails.

This exception is used by adapter implementations (e.g., ADKAdapter) for adapter-specific failures such as session errors or configuration issues.

Examples:

Raising an adapter error:

from gepa_adk.domain.exceptions import AdapterError

if not self._session_service:
    raise AdapterError(
        "Session service unavailable",
        adapter="ADKAdapter",
        operation="evaluate",
    )
Note

AdapterError is a subclass of EvaluationError, so callers can catch either for different granularity of error handling.

Source code in src/gepa_adk/domain/exceptions.py
class AdapterError(EvaluationError):
    """Raised when an adapter operation fails.

    This exception is used by adapter implementations (e.g., ADKAdapter)
    for adapter-specific failures such as session errors or configuration
    issues.

    Examples:
        Raising an adapter error:

        ```python
        from gepa_adk.domain.exceptions import AdapterError

        if not self._session_service:
            raise AdapterError(
                "Session service unavailable",
                adapter="ADKAdapter",
                operation="evaluate",
            )
        ```

    Note:
        AdapterError is a subclass of EvaluationError, so callers can
        catch either for different granularity of error handling.
    """

RestoreError

Bases: AdapterError


              flowchart TD
              gepa_adk.domain.exceptions.RestoreError[RestoreError]
              gepa_adk.domain.exceptions.AdapterError[AdapterError]
              gepa_adk.domain.exceptions.EvaluationError[EvaluationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.AdapterError --> gepa_adk.domain.exceptions.RestoreError
                                gepa_adk.domain.exceptions.EvaluationError --> gepa_adk.domain.exceptions.AdapterError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.EvaluationError
                




              click gepa_adk.domain.exceptions.RestoreError href "" "gepa_adk.domain.exceptions.RestoreError"
              click gepa_adk.domain.exceptions.AdapterError href "" "gepa_adk.domain.exceptions.AdapterError"
              click gepa_adk.domain.exceptions.EvaluationError href "" "gepa_adk.domain.exceptions.EvaluationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when agent restoration fails after evaluation.

This exception is raised when one or more agent components fail to restore to their original state after candidate evaluation. Uses best-effort restoration: all components are attempted even if some fail, then errors are aggregated into this exception.

ATTRIBUTE DESCRIPTION
errors

List of (qualified_name, exception) pairs for each failed restoration.

TYPE: list[tuple[str, Exception]]

Examples:

Handling partial restore failures:

from gepa_adk.domain.exceptions import RestoreError

try:
    adapter._restore_agents(originals)
except RestoreError as e:
    for qualified_name, error in e.errors:
        print(f"Failed to restore {qualified_name}: {error}")

Aggregating restoration failures:

errors = []
for name, original in originals.items():
    try:
        handler.restore(agent, original)
    except Exception as exc:
        errors.append((name, exc))
if errors:
    raise RestoreError(
        f"Failed to restore {len(errors)} components",
        errors=errors,
    )
Note

As a subclass of AdapterError, this exception indicates that the agent state may be corrupted and manual intervention may be required to reset agents to a known state.

Source code in src/gepa_adk/domain/exceptions.py
class RestoreError(AdapterError):
    """Raised when agent restoration fails after evaluation.

    This exception is raised when one or more agent components fail to
    restore to their original state after candidate evaluation. Uses
    best-effort restoration: all components are attempted even if some fail,
    then errors are aggregated into this exception.

    Attributes:
        errors (list[tuple[str, Exception]]): List of (qualified_name, exception)
            pairs for each failed restoration.

    Examples:
        Handling partial restore failures:

        ```python
        from gepa_adk.domain.exceptions import RestoreError

        try:
            adapter._restore_agents(originals)
        except RestoreError as e:
            for qualified_name, error in e.errors:
                print(f"Failed to restore {qualified_name}: {error}")
        ```

        Aggregating restoration failures:

        ```python
        errors = []
        for name, original in originals.items():
            try:
                handler.restore(agent, original)
            except Exception as exc:
                errors.append((name, exc))
        if errors:
            raise RestoreError(
                f"Failed to restore {len(errors)} components",
                errors=errors,
            )
        ```

    Note:
        As a subclass of AdapterError, this exception indicates that the
        agent state may be corrupted and manual intervention may be required
        to reset agents to a known state.
    """

    def __init__(
        self,
        message: str,
        *,
        errors: list[tuple[str, Exception]],
        cause: Exception | None = None,
    ) -> None:
        """Initialize RestoreError with aggregated failures.

        Args:
            message: Human-readable error summary.
            errors: List of (qualified_name, exception) pairs for each failed
                restoration. Must be non-empty when raising this exception.
            cause: Optional underlying cause exception.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, cause=cause)
        self.errors = errors

    def __str__(self) -> str:
        """Return string with failed component names.

        Returns:
            Formatted message including list of failed qualified names.

        Note:
            Outputs formatted error message with list of failed qualified
            names, preserving base message structure.
        """
        base = super().__str__()
        failed_names = [name for name, _ in self.errors]
        return f"{base} [failed_components={failed_names}]"

__init__

__init__(
    message: str,
    *,
    errors: list[tuple[str, Exception]],
    cause: Exception | None = None,
) -> None

Initialize RestoreError with aggregated failures.

PARAMETER DESCRIPTION
message

Human-readable error summary.

TYPE: str

errors

List of (qualified_name, exception) pairs for each failed restoration. Must be non-empty when raising this exception.

TYPE: list[tuple[str, Exception]]

cause

Optional underlying cause exception.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    errors: list[tuple[str, Exception]],
    cause: Exception | None = None,
) -> None:
    """Initialize RestoreError with aggregated failures.

    Args:
        message: Human-readable error summary.
        errors: List of (qualified_name, exception) pairs for each failed
            restoration. Must be non-empty when raising this exception.
        cause: Optional underlying cause exception.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, cause=cause)
    self.errors = errors

__str__

__str__() -> str

Return string with failed component names.

RETURNS DESCRIPTION
str

Formatted message including list of failed qualified names.

Note

Outputs formatted error message with list of failed qualified names, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with failed component names.

    Returns:
        Formatted message including list of failed qualified names.

    Note:
        Outputs formatted error message with list of failed qualified
        names, preserving base message structure.
    """
    base = super().__str__()
    failed_names = [name for name, _ in self.errors]
    return f"{base} [failed_components={failed_names}]"

ScoringError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                


              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Base exception for all scoring-related errors.

All scoring exceptions inherit from this class to allow for unified exception handling in scoring operations.

ATTRIBUTE DESCRIPTION
cause

Original exception that caused this error.

TYPE: Exception | None

Examples:

Catching scoring errors:

from gepa_adk.domain.exceptions import ScoringError

try:
    score, metadata = await scorer.async_score(...)
except ScoringError as e:
    print(f"Scoring failed: {e}")
Note

All scoring exceptions inherit from this base class. ScoringError extends EvolutionError, following ADR-009 exception hierarchy guidelines.

Source code in src/gepa_adk/domain/exceptions.py
class ScoringError(EvolutionError):
    """Base exception for all scoring-related errors.

    All scoring exceptions inherit from this class to allow for unified
    exception handling in scoring operations.

    Attributes:
        cause (Exception | None): Original exception that caused this error.

    Examples:
        Catching scoring errors:

        ```python
        from gepa_adk.domain.exceptions import ScoringError

        try:
            score, metadata = await scorer.async_score(...)
        except ScoringError as e:
            print(f"Scoring failed: {e}")
        ```

    Note:
        All scoring exceptions inherit from this base class.
        ScoringError extends EvolutionError, following ADR-009 exception
        hierarchy guidelines.
    """

    def __init__(
        self,
        message: str,
        *,
        cause: Exception | None = None,
    ) -> None:
        """Initialize ScoringError with message and optional cause.

        Args:
            message: Human-readable error description.
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.cause = cause

    def __str__(self) -> str:
        """Return string with cause chain if present.

        Returns:
            Formatted message with cause information.

        Note:
            Outputs formatted error message with cause chain when available,
            preserving base message structure.
        """
        base = super().__str__()
        if self.cause:
            base = f"{base} (caused by: {self.cause})"
        return base

__init__

__init__(
    message: str, *, cause: Exception | None = None
) -> None

Initialize ScoringError with message and optional cause.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    cause: Exception | None = None,
) -> None:
    """Initialize ScoringError with message and optional cause.

    Args:
        message: Human-readable error description.
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.cause = cause

__str__

__str__() -> str

Return string with cause chain if present.

RETURNS DESCRIPTION
str

Formatted message with cause information.

Note

Outputs formatted error message with cause chain when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with cause chain if present.

    Returns:
        Formatted message with cause information.

    Note:
        Outputs formatted error message with cause chain when available,
        preserving base message structure.
    """
    base = super().__str__()
    if self.cause:
        base = f"{base} (caused by: {self.cause})"
    return base

CriticOutputParseError

Bases: ScoringError


              flowchart TD
              gepa_adk.domain.exceptions.CriticOutputParseError[CriticOutputParseError]
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.CriticOutputParseError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                



              click gepa_adk.domain.exceptions.CriticOutputParseError href "" "gepa_adk.domain.exceptions.CriticOutputParseError"
              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when critic agent output cannot be parsed as valid JSON.

This exception indicates that the critic agent returned output that could not be parsed as JSON or did not conform to the expected schema.

ATTRIBUTE DESCRIPTION
raw_output

The unparseable output from critic.

TYPE: str

parse_error

Description of parsing failure.

TYPE: str

Examples:

Handling parse errors:

from gepa_adk.domain.exceptions import CriticOutputParseError

try:
    score, metadata = await scorer.async_score(...)
except CriticOutputParseError as e:
    print(f"Invalid JSON: {e.raw_output}")
    print(f"Error: {e.parse_error}")
Note

Arises when critic agent output cannot be parsed as valid JSON. Typically occurs when LLM output doesn't follow structured format despite output_schema being set.

Source code in src/gepa_adk/domain/exceptions.py
class CriticOutputParseError(ScoringError):
    """Raised when critic agent output cannot be parsed as valid JSON.

    This exception indicates that the critic agent returned output that
    could not be parsed as JSON or did not conform to the expected schema.

    Attributes:
        raw_output (str): The unparseable output from critic.
        parse_error (str): Description of parsing failure.

    Examples:
        Handling parse errors:

        ```python
        from gepa_adk.domain.exceptions import CriticOutputParseError

        try:
            score, metadata = await scorer.async_score(...)
        except CriticOutputParseError as e:
            print(f"Invalid JSON: {e.raw_output}")
            print(f"Error: {e.parse_error}")
        ```

    Note:
        Arises when critic agent output cannot be parsed as valid JSON.
        Typically occurs when LLM output doesn't follow structured format
        despite output_schema being set.
    """

    def __init__(
        self,
        message: str,
        *,
        raw_output: str,
        parse_error: str,
        cause: Exception | None = None,
    ) -> None:
        """Initialize CriticOutputParseError with context.

        Args:
            message: Human-readable error description.
            raw_output: The unparseable output string from critic.
            parse_error: Description of the parsing failure.
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, cause=cause)
        self.raw_output = raw_output
        self.parse_error = parse_error

    def __str__(self) -> str:
        """Return string with parse error details.

        Returns:
            Formatted message including parse error and raw output preview.

        Note:
            Outputs formatted error message with parse error and raw output
            preview (truncated to 100 chars), preserving base message structure.
        """
        base = super().__str__()
        output_preview = (
            self.raw_output[:100] + "..."
            if len(self.raw_output) > 100
            else self.raw_output
        )
        return (
            f"{base} [parse_error={self.parse_error!r}, raw_output={output_preview!r}]"
        )

__init__

__init__(
    message: str,
    *,
    raw_output: str,
    parse_error: str,
    cause: Exception | None = None,
) -> None

Initialize CriticOutputParseError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

raw_output

The unparseable output string from critic.

TYPE: str

parse_error

Description of the parsing failure.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    raw_output: str,
    parse_error: str,
    cause: Exception | None = None,
) -> None:
    """Initialize CriticOutputParseError with context.

    Args:
        message: Human-readable error description.
        raw_output: The unparseable output string from critic.
        parse_error: Description of the parsing failure.
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, cause=cause)
    self.raw_output = raw_output
    self.parse_error = parse_error

__str__

__str__() -> str

Return string with parse error details.

RETURNS DESCRIPTION
str

Formatted message including parse error and raw output preview.

Note

Outputs formatted error message with parse error and raw output preview (truncated to 100 chars), preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with parse error details.

    Returns:
        Formatted message including parse error and raw output preview.

    Note:
        Outputs formatted error message with parse error and raw output
        preview (truncated to 100 chars), preserving base message structure.
    """
    base = super().__str__()
    output_preview = (
        self.raw_output[:100] + "..."
        if len(self.raw_output) > 100
        else self.raw_output
    )
    return (
        f"{base} [parse_error={self.parse_error!r}, raw_output={output_preview!r}]"
    )

OutputParseError

Bases: ScoringError


              flowchart TD
              gepa_adk.domain.exceptions.OutputParseError[OutputParseError]
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.OutputParseError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                



              click gepa_adk.domain.exceptions.OutputParseError href "" "gepa_adk.domain.exceptions.OutputParseError"
              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when agent output cannot be parsed as valid JSON.

This exception indicates that the agent returned output that could not be parsed as JSON.

ATTRIBUTE DESCRIPTION
raw_output

The unparseable output from agent.

TYPE: str

parse_error

Description of parsing failure.

TYPE: str

Examples:

Handling parse errors:

from gepa_adk.domain.exceptions import OutputParseError

try:
    score, metadata = scorer.score(input_text, output)
except OutputParseError as e:
    print(f"Invalid JSON: {e.raw_output[:50]}")
    print(f"Error: {e.parse_error}")
Note

Arises when agent output cannot be parsed as valid JSON. Typically occurs when LLM output doesn't follow structured format.

Source code in src/gepa_adk/domain/exceptions.py
class OutputParseError(ScoringError):
    """Raised when agent output cannot be parsed as valid JSON.

    This exception indicates that the agent returned output that
    could not be parsed as JSON.

    Attributes:
        raw_output (str): The unparseable output from agent.
        parse_error (str): Description of parsing failure.

    Examples:
        Handling parse errors:

        ```python
        from gepa_adk.domain.exceptions import OutputParseError

        try:
            score, metadata = scorer.score(input_text, output)
        except OutputParseError as e:
            print(f"Invalid JSON: {e.raw_output[:50]}")
            print(f"Error: {e.parse_error}")
        ```

    Note:
        Arises when agent output cannot be parsed as valid JSON.
        Typically occurs when LLM output doesn't follow structured format.
    """

    def __init__(
        self,
        message: str,
        *,
        raw_output: str,
        parse_error: str,
        cause: Exception | None = None,
    ) -> None:
        """Initialize OutputParseError with context.

        Args:
            message: Human-readable error description.
            raw_output: The unparseable output string from agent.
            parse_error: Description of the parsing failure.
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, cause=cause)
        self.raw_output = raw_output
        self.parse_error = parse_error

    def __str__(self) -> str:
        """Return string with parse error details.

        Returns:
            Formatted message including parse error and raw output preview.

        Note:
            Outputs formatted error message with parse error and raw output
            preview (truncated to 100 chars), preserving base message structure.
        """
        base = super().__str__()
        output_preview = (
            self.raw_output[:100] + "..."
            if len(self.raw_output) > 100
            else self.raw_output
        )
        return (
            f"{base} [parse_error={self.parse_error!r}, raw_output={output_preview!r}]"
        )

__init__

__init__(
    message: str,
    *,
    raw_output: str,
    parse_error: str,
    cause: Exception | None = None,
) -> None

Initialize OutputParseError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

raw_output

The unparseable output string from agent.

TYPE: str

parse_error

Description of the parsing failure.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    raw_output: str,
    parse_error: str,
    cause: Exception | None = None,
) -> None:
    """Initialize OutputParseError with context.

    Args:
        message: Human-readable error description.
        raw_output: The unparseable output string from agent.
        parse_error: Description of the parsing failure.
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, cause=cause)
    self.raw_output = raw_output
    self.parse_error = parse_error

__str__

__str__() -> str

Return string with parse error details.

RETURNS DESCRIPTION
str

Formatted message including parse error and raw output preview.

Note

Outputs formatted error message with parse error and raw output preview (truncated to 100 chars), preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with parse error details.

    Returns:
        Formatted message including parse error and raw output preview.

    Note:
        Outputs formatted error message with parse error and raw output
        preview (truncated to 100 chars), preserving base message structure.
    """
    base = super().__str__()
    output_preview = (
        self.raw_output[:100] + "..."
        if len(self.raw_output) > 100
        else self.raw_output
    )
    return (
        f"{base} [parse_error={self.parse_error!r}, raw_output={output_preview!r}]"
    )

SchemaValidationError

Bases: ScoringError


              flowchart TD
              gepa_adk.domain.exceptions.SchemaValidationError[SchemaValidationError]
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.SchemaValidationError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                



              click gepa_adk.domain.exceptions.SchemaValidationError href "" "gepa_adk.domain.exceptions.SchemaValidationError"
              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when output fails Pydantic schema validation.

This exception indicates that the agent output was valid JSON but did not conform to the expected Pydantic schema. Also used for schema text validation during output schema evolution.

ATTRIBUTE DESCRIPTION
raw_output

The output that failed validation.

TYPE: str

validation_error

Description of validation failure.

TYPE: str

line_number

Line number where error occurred (for syntax errors).

TYPE: int | None

validation_stage

Stage where validation failed ("syntax", "structure", or "execution").

TYPE: str | None

Examples:

Handling schema validation errors:

from gepa_adk.domain.exceptions import SchemaValidationError

try:
    score, metadata = scorer.score(input_text, output)
except SchemaValidationError as e:
    print(f"Schema mismatch: {e.validation_error}")
    if e.line_number:
        print(f"Error at line {e.line_number}")
Note

Arises when output is valid JSON but doesn't match the schema. Typically occurs when field types are wrong or required fields have invalid values. For schema evolution, also raised when proposed schema text is syntactically invalid or structurally incorrect (e.g., missing BaseModel inheritance).

Source code in src/gepa_adk/domain/exceptions.py
class SchemaValidationError(ScoringError):
    """Raised when output fails Pydantic schema validation.

    This exception indicates that the agent output was valid JSON but
    did not conform to the expected Pydantic schema. Also used for
    schema text validation during output schema evolution.

    Attributes:
        raw_output (str): The output that failed validation.
        validation_error (str): Description of validation failure.
        line_number (int | None): Line number where error occurred (for syntax errors).
        validation_stage (str | None): Stage where validation failed
            ("syntax", "structure", or "execution").

    Examples:
        Handling schema validation errors:

        ```python
        from gepa_adk.domain.exceptions import SchemaValidationError

        try:
            score, metadata = scorer.score(input_text, output)
        except SchemaValidationError as e:
            print(f"Schema mismatch: {e.validation_error}")
            if e.line_number:
                print(f"Error at line {e.line_number}")
        ```

    Note:
        Arises when output is valid JSON but doesn't match the schema.
        Typically occurs when field types are wrong or required fields
        have invalid values. For schema evolution, also raised when
        proposed schema text is syntactically invalid or structurally
        incorrect (e.g., missing BaseModel inheritance).
    """

    def __init__(
        self,
        message: str,
        *,
        raw_output: str,
        validation_error: str,
        cause: Exception | None = None,
        line_number: int | None = None,
        validation_stage: str | None = None,
    ) -> None:
        """Initialize SchemaValidationError with context.

        Args:
            message: Human-readable error description.
            raw_output: The output string that failed validation.
            validation_error: Description of the validation failure.
            cause: Original exception that caused this error.
            line_number: Line number where error occurred (for syntax errors).
            validation_stage: Stage where validation failed. One of:
                - "syntax": Python syntax error
                - "structure": Missing BaseModel, has imports/functions
                - "execution": Error during exec()

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, cause=cause)
        self.raw_output = raw_output
        self.validation_error = validation_error
        self.line_number = line_number
        self.validation_stage = validation_stage

    def __str__(self) -> str:
        """Return string with validation error details.

        Returns:
            Formatted message including validation error details.

        Note:
            Outputs formatted error message with validation error and raw output
            preview (truncated to 100 chars), preserving base message structure.
        """
        base = super().__str__()
        output_preview = (
            self.raw_output[:100] + "..."
            if len(self.raw_output) > 100
            else self.raw_output
        )
        parts = [f"validation_error={self.validation_error!r}"]
        if self.line_number is not None:
            parts.append(f"line={self.line_number}")
        if self.validation_stage is not None:
            parts.append(f"stage={self.validation_stage!r}")
        parts.append(f"raw_output={output_preview!r}")
        return f"{base} [{', '.join(parts)}]"

__init__

__init__(
    message: str,
    *,
    raw_output: str,
    validation_error: str,
    cause: Exception | None = None,
    line_number: int | None = None,
    validation_stage: str | None = None,
) -> None

Initialize SchemaValidationError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

raw_output

The output string that failed validation.

TYPE: str

validation_error

Description of the validation failure.

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

line_number

Line number where error occurred (for syntax errors).

TYPE: int | None DEFAULT: None

validation_stage

Stage where validation failed. One of: - "syntax": Python syntax error - "structure": Missing BaseModel, has imports/functions - "execution": Error during exec()

TYPE: str | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    raw_output: str,
    validation_error: str,
    cause: Exception | None = None,
    line_number: int | None = None,
    validation_stage: str | None = None,
) -> None:
    """Initialize SchemaValidationError with context.

    Args:
        message: Human-readable error description.
        raw_output: The output string that failed validation.
        validation_error: Description of the validation failure.
        cause: Original exception that caused this error.
        line_number: Line number where error occurred (for syntax errors).
        validation_stage: Stage where validation failed. One of:
            - "syntax": Python syntax error
            - "structure": Missing BaseModel, has imports/functions
            - "execution": Error during exec()

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, cause=cause)
    self.raw_output = raw_output
    self.validation_error = validation_error
    self.line_number = line_number
    self.validation_stage = validation_stage

__str__

__str__() -> str

Return string with validation error details.

RETURNS DESCRIPTION
str

Formatted message including validation error details.

Note

Outputs formatted error message with validation error and raw output preview (truncated to 100 chars), preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with validation error details.

    Returns:
        Formatted message including validation error details.

    Note:
        Outputs formatted error message with validation error and raw output
        preview (truncated to 100 chars), preserving base message structure.
    """
    base = super().__str__()
    output_preview = (
        self.raw_output[:100] + "..."
        if len(self.raw_output) > 100
        else self.raw_output
    )
    parts = [f"validation_error={self.validation_error!r}"]
    if self.line_number is not None:
        parts.append(f"line={self.line_number}")
    if self.validation_stage is not None:
        parts.append(f"stage={self.validation_stage!r}")
    parts.append(f"raw_output={output_preview!r}")
    return f"{base} [{', '.join(parts)}]"

MissingScoreFieldError

Bases: ScoringError


              flowchart TD
              gepa_adk.domain.exceptions.MissingScoreFieldError[MissingScoreFieldError]
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.MissingScoreFieldError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                



              click gepa_adk.domain.exceptions.MissingScoreFieldError href "" "gepa_adk.domain.exceptions.MissingScoreFieldError"
              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when score field is missing or null in parsed output.

This exception indicates that the output was successfully parsed and validated, but the required score field is missing or null.

ATTRIBUTE DESCRIPTION
parsed_output

The parsed output without valid score.

TYPE: dict[str, Any]

available_fields

Fields that were present.

TYPE: list[str]

Examples:

Handling missing score field:

from gepa_adk.domain.exceptions import MissingScoreFieldError

try:
    score, metadata = await scorer.async_score(...)
except MissingScoreFieldError as e:
    print(f"Missing score. Available fields: {e.available_fields}")
Note

Applies when parsed output lacks a valid score value. The parsed_output may contain other valid fields that will be preserved in metadata if score is found.

Source code in src/gepa_adk/domain/exceptions.py
class MissingScoreFieldError(ScoringError):
    """Raised when score field is missing or null in parsed output.

    This exception indicates that the output was successfully parsed
    and validated, but the required `score` field is missing or null.

    Attributes:
        parsed_output (dict[str, Any]): The parsed output without valid score.
        available_fields (list[str]): Fields that were present.

    Examples:
        Handling missing score field:

        ```python
        from gepa_adk.domain.exceptions import MissingScoreFieldError

        try:
            score, metadata = await scorer.async_score(...)
        except MissingScoreFieldError as e:
            print(f"Missing score. Available fields: {e.available_fields}")
        ```

    Note:
        Applies when parsed output lacks a valid score value.
        The parsed_output may contain other valid fields that will be
        preserved in metadata if score is found.
    """

    def __init__(
        self,
        message: str,
        *,
        parsed_output: dict[str, Any],
        cause: Exception | None = None,
    ) -> None:
        """Initialize MissingScoreFieldError with parsed output.

        Args:
            message: Human-readable error description.
            parsed_output: The parsed dict without valid score field.
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, cause=cause)
        self.parsed_output = parsed_output
        self.available_fields = list(parsed_output.keys())

    def __str__(self) -> str:
        """Return string with available fields.

        Returns:
            Formatted message including list of available fields.

        Note:
            Outputs formatted error message with list of available fields
            from parsed output, preserving base message structure.
        """
        base = super().__str__()
        return f"{base} [available_fields={self.available_fields}]"

__init__

__init__(
    message: str,
    *,
    parsed_output: dict[str, Any],
    cause: Exception | None = None,
) -> None

Initialize MissingScoreFieldError with parsed output.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

parsed_output

The parsed dict without valid score field.

TYPE: dict[str, Any]

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    parsed_output: dict[str, Any],
    cause: Exception | None = None,
) -> None:
    """Initialize MissingScoreFieldError with parsed output.

    Args:
        message: Human-readable error description.
        parsed_output: The parsed dict without valid score field.
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, cause=cause)
    self.parsed_output = parsed_output
    self.available_fields = list(parsed_output.keys())

__str__

__str__() -> str

Return string with available fields.

RETURNS DESCRIPTION
str

Formatted message including list of available fields.

Note

Outputs formatted error message with list of available fields from parsed output, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with available fields.

    Returns:
        Formatted message including list of available fields.

    Note:
        Outputs formatted error message with list of available fields
        from parsed output, preserving base message structure.
    """
    base = super().__str__()
    return f"{base} [available_fields={self.available_fields}]"

VideoValidationError

Bases: ConfigurationError


              flowchart TD
              gepa_adk.domain.exceptions.VideoValidationError[VideoValidationError]
              gepa_adk.domain.exceptions.ConfigurationError[ConfigurationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ConfigurationError --> gepa_adk.domain.exceptions.VideoValidationError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigurationError
                



              click gepa_adk.domain.exceptions.VideoValidationError href "" "gepa_adk.domain.exceptions.VideoValidationError"
              click gepa_adk.domain.exceptions.ConfigurationError href "" "gepa_adk.domain.exceptions.ConfigurationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when video file validation fails.

This exception is raised during video file processing when a video file does not exist, exceeds size limits, or has an invalid MIME type.

ATTRIBUTE DESCRIPTION
video_path

The path to the video file that failed validation.

TYPE: str

field

The configuration field name (default "video").

TYPE: str

constraint

Description of the validation constraint that was violated.

TYPE: str

Examples:

Raising a video validation error:

from gepa_adk.domain.exceptions import VideoValidationError

raise VideoValidationError(
    "Video file not found",
    video_path="/path/to/missing.mp4",
    constraint="file must exist",
)

Handling video validation errors:

from gepa_adk.domain.exceptions import VideoValidationError

try:
    await video_service.prepare_video_parts(["/bad/path.mp4"])
except VideoValidationError as e:
    print(f"Invalid video: {e.video_path}")
    print(f"Constraint violated: {e.constraint}")
Note

Arises from video file validation failures during multimodal input processing. File existence, size limits (2GB), and MIME type (video/*) are validated before loading video content.

Source code in src/gepa_adk/domain/exceptions.py
class VideoValidationError(ConfigurationError):
    """Raised when video file validation fails.

    This exception is raised during video file processing when a video
    file does not exist, exceeds size limits, or has an invalid MIME type.

    Attributes:
        video_path (str): The path to the video file that failed validation.
        field (str): The configuration field name (default "video").
        constraint (str): Description of the validation constraint that was violated.

    Examples:
        Raising a video validation error:

        ```python
        from gepa_adk.domain.exceptions import VideoValidationError

        raise VideoValidationError(
            "Video file not found",
            video_path="/path/to/missing.mp4",
            constraint="file must exist",
        )
        ```

        Handling video validation errors:

        ```python
        from gepa_adk.domain.exceptions import VideoValidationError

        try:
            await video_service.prepare_video_parts(["/bad/path.mp4"])
        except VideoValidationError as e:
            print(f"Invalid video: {e.video_path}")
            print(f"Constraint violated: {e.constraint}")
        ```

    Note:
        Arises from video file validation failures during multimodal input
        processing. File existence, size limits (2GB), and MIME type
        (video/*) are validated before loading video content.
    """

    def __init__(
        self,
        message: str,
        *,
        video_path: str,
        field: str = "video",
        constraint: str,
    ) -> None:
        """Initialize VideoValidationError with video file context.

        Args:
            message: Human-readable error description.
            video_path: The path to the video file that failed validation.
            field: Name of the configuration field (default "video").
            constraint: Description of the validation constraint violated.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message, field=field, value=video_path, constraint=constraint)
        self.video_path = video_path

    def __str__(self) -> str:
        """Return string representation with video path context.

        Returns:
            Formatted error message including video_path and constraint.

        Note:
            Outputs formatted error message with video_path for easy
            identification of the problematic file in error logs.
        """
        base = Exception.__str__(self)
        return (
            f"{base} [video_path={self.video_path!r}, constraint={self.constraint!r}]"
        )

__init__

__init__(
    message: str,
    *,
    video_path: str,
    field: str = "video",
    constraint: str,
) -> None

Initialize VideoValidationError with video file context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

video_path

The path to the video file that failed validation.

TYPE: str

field

Name of the configuration field (default "video").

TYPE: str DEFAULT: 'video'

constraint

Description of the validation constraint violated.

TYPE: str

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    video_path: str,
    field: str = "video",
    constraint: str,
) -> None:
    """Initialize VideoValidationError with video file context.

    Args:
        message: Human-readable error description.
        video_path: The path to the video file that failed validation.
        field: Name of the configuration field (default "video").
        constraint: Description of the validation constraint violated.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message, field=field, value=video_path, constraint=constraint)
    self.video_path = video_path

__str__

__str__() -> str

Return string representation with video path context.

RETURNS DESCRIPTION
str

Formatted error message including video_path and constraint.

Note

Outputs formatted error message with video_path for easy identification of the problematic file in error logs.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string representation with video path context.

    Returns:
        Formatted error message including video_path and constraint.

    Note:
        Outputs formatted error message with video_path for easy
        identification of the problematic file in error logs.
    """
    base = Exception.__str__(self)
    return (
        f"{base} [video_path={self.video_path!r}, constraint={self.constraint!r}]"
    )

MultiAgentValidationError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.MultiAgentValidationError[MultiAgentValidationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.MultiAgentValidationError
                


              click gepa_adk.domain.exceptions.MultiAgentValidationError href "" "gepa_adk.domain.exceptions.MultiAgentValidationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when multi-agent configuration validation fails.

This exception is raised during MultiAgentAdapter initialization when a parameter violates its validation constraints.

ATTRIBUTE DESCRIPTION
field

The name of the configuration field that failed validation.

TYPE: str

value

The invalid value that was provided.

TYPE: object

constraint

Description of the validation constraint that was violated.

TYPE: str

Examples:

Creating a multi-agent validation error:

from gepa_adk.domain.exceptions import MultiAgentValidationError

error = MultiAgentValidationError(
    "agents list cannot be empty",
    field="agents",
    value=[],
    constraint="len >= 1",
)
print(error.field, error.value)  # agents []
Note

Arises from user-provided invalid multi-agent settings, not programming errors. Should be caught and reported with clear guidance on valid values.

Source code in src/gepa_adk/domain/exceptions.py
class MultiAgentValidationError(EvolutionError):
    """Raised when multi-agent configuration validation fails.

    This exception is raised during MultiAgentAdapter initialization
    when a parameter violates its validation constraints.

    Attributes:
        field (str): The name of the configuration field that failed
            validation.
        value (object): The invalid value that was provided.
        constraint (str): Description of the validation constraint that
            was violated.

    Examples:
        Creating a multi-agent validation error:

        ```python
        from gepa_adk.domain.exceptions import MultiAgentValidationError

        error = MultiAgentValidationError(
            "agents list cannot be empty",
            field="agents",
            value=[],
            constraint="len >= 1",
        )
        print(error.field, error.value)  # agents []
        ```

    Note:
        Arises from user-provided invalid multi-agent settings, not
        programming errors. Should be caught and reported with clear
        guidance on valid values.
    """

    def __init__(
        self,
        message: str,
        *,
        field: str,
        value: object,
        constraint: str,
    ) -> None:
        """Initialize MultiAgentValidationError with context.

        Args:
            message: Human-readable error description.
            field: Name of the invalid configuration field.
            value: The invalid value provided.
            constraint: Description of the validation constraint.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.field = field
        self.value = value
        self.constraint = constraint

    def __str__(self) -> str:
        """Return string representation with context.

        Returns:
            Formatted error message including field and value context.

        Note:
            Outputs formatted error message with field, value, and constraint
            context when available, preserving base message structure.
        """
        base = super().__str__()
        return (
            f"{base} [field={self.field!r}, value={self.value!r}, "
            f"constraint={self.constraint!r}]"
        )

__init__

__init__(
    message: str,
    *,
    field: str,
    value: object,
    constraint: str,
) -> None

Initialize MultiAgentValidationError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

field

Name of the invalid configuration field.

TYPE: str

value

The invalid value provided.

TYPE: object

constraint

Description of the validation constraint.

TYPE: str

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    field: str,
    value: object,
    constraint: str,
) -> None:
    """Initialize MultiAgentValidationError with context.

    Args:
        message: Human-readable error description.
        field: Name of the invalid configuration field.
        value: The invalid value provided.
        constraint: Description of the validation constraint.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.field = field
    self.value = value
    self.constraint = constraint

__str__

__str__() -> str

Return string representation with context.

RETURNS DESCRIPTION
str

Formatted error message including field and value context.

Note

Outputs formatted error message with field, value, and constraint context when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string representation with context.

    Returns:
        Formatted error message including field and value context.

    Note:
        Outputs formatted error message with field, value, and constraint
        context when available, preserving base message structure.
    """
    base = super().__str__()
    return (
        f"{base} [field={self.field!r}, value={self.value!r}, "
        f"constraint={self.constraint!r}]"
    )

WorkflowEvolutionError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.WorkflowEvolutionError[WorkflowEvolutionError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.WorkflowEvolutionError
                


              click gepa_adk.domain.exceptions.WorkflowEvolutionError href "" "gepa_adk.domain.exceptions.WorkflowEvolutionError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when workflow evolution fails.

This exception is raised during workflow evolution when the workflow structure is invalid or no evolvable agents are found.

ATTRIBUTE DESCRIPTION
workflow_name

Name of the workflow that failed.

TYPE: str | None

cause

Original exception that caused this error.

TYPE: Exception | None

Examples:

Handling workflow evolution errors:

from gepa_adk.domain.exceptions import WorkflowEvolutionError

try:
    result = await evolve_workflow(workflow=empty_workflow, trainset=trainset)
except WorkflowEvolutionError as e:
    print(f"Workflow '{e.workflow_name}' failed: {e}")
Note

Arises when workflow contains no LlmAgents or evolution fails during execution. Follows ADR-009 exception hierarchy.

Source code in src/gepa_adk/domain/exceptions.py
class WorkflowEvolutionError(EvolutionError):
    """Raised when workflow evolution fails.

    This exception is raised during workflow evolution when the workflow
    structure is invalid or no evolvable agents are found.

    Attributes:
        workflow_name (str | None): Name of the workflow that failed.
        cause (Exception | None): Original exception that caused this error.

    Examples:
        Handling workflow evolution errors:

        ```python
        from gepa_adk.domain.exceptions import WorkflowEvolutionError

        try:
            result = await evolve_workflow(workflow=empty_workflow, trainset=trainset)
        except WorkflowEvolutionError as e:
            print(f"Workflow '{e.workflow_name}' failed: {e}")
        ```

    Note:
        Arises when workflow contains no LlmAgents or evolution fails
        during execution. Follows ADR-009 exception hierarchy.
    """

    def __init__(
        self,
        message: str,
        *,
        workflow_name: str | None = None,
        cause: Exception | None = None,
    ) -> None:
        """Initialize WorkflowEvolutionError with context.

        Args:
            message: Human-readable error description.
            workflow_name: Name of the workflow that failed.
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.workflow_name = workflow_name
        self.cause = cause

    def __str__(self) -> str:
        """Return string with cause chain if present.

        Returns:
            Formatted message with workflow name and cause information.

        Note:
            Outputs formatted error message including workflow context when
            available. Preserves cause chain for debugging nested exceptions.
        """
        base = super().__str__()
        if self.workflow_name:
            base = f"{base} [workflow_name={self.workflow_name!r}]"
        if self.cause:
            base = f"{base} (caused by: {self.cause})"
        return base

__init__

__init__(
    message: str,
    *,
    workflow_name: str | None = None,
    cause: Exception | None = None,
) -> None

Initialize WorkflowEvolutionError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

workflow_name

Name of the workflow that failed.

TYPE: str | None DEFAULT: None

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    workflow_name: str | None = None,
    cause: Exception | None = None,
) -> None:
    """Initialize WorkflowEvolutionError with context.

    Args:
        message: Human-readable error description.
        workflow_name: Name of the workflow that failed.
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.workflow_name = workflow_name
    self.cause = cause

__str__

__str__() -> str

Return string with cause chain if present.

RETURNS DESCRIPTION
str

Formatted message with workflow name and cause information.

Note

Outputs formatted error message including workflow context when available. Preserves cause chain for debugging nested exceptions.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with cause chain if present.

    Returns:
        Formatted message with workflow name and cause information.

    Note:
        Outputs formatted error message including workflow context when
        available. Preserves cause chain for debugging nested exceptions.
    """
    base = super().__str__()
    if self.workflow_name:
        base = f"{base} [workflow_name={self.workflow_name!r}]"
    if self.cause:
        base = f"{base} (caused by: {self.cause})"
    return base

ConfigValidationError

Bases: EvolutionError


              flowchart TD
              gepa_adk.domain.exceptions.ConfigValidationError[ConfigValidationError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ConfigValidationError
                


              click gepa_adk.domain.exceptions.ConfigValidationError href "" "gepa_adk.domain.exceptions.ConfigValidationError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when config validation fails.

This exception is raised during generate_content_config evolution when a proposed config contains invalid parameter values or malformed YAML.

ATTRIBUTE DESCRIPTION
message

Human-readable error message.

TYPE: str

errors

List of individual validation errors.

TYPE: list[str]

Examples:

Creating a config validation error:

from gepa_adk.domain.exceptions import ConfigValidationError

error = ConfigValidationError(
    "Config validation failed",
    errors=["temperature must be 0.0-2.0, got 3.0"],
)
print(error.errors)  # ["temperature must be 0.0-2.0, got 3.0"]
Note

Arises when proposed config values violate parameter constraints or when YAML parsing fails. Should be caught and logged as a warning, with the original config preserved.

Source code in src/gepa_adk/domain/exceptions.py
class ConfigValidationError(EvolutionError):
    """Raised when config validation fails.

    This exception is raised during generate_content_config evolution
    when a proposed config contains invalid parameter values or malformed YAML.

    Attributes:
        message (str): Human-readable error message.
        errors (list[str]): List of individual validation errors.

    Examples:
        Creating a config validation error:

        ```python
        from gepa_adk.domain.exceptions import ConfigValidationError

        error = ConfigValidationError(
            "Config validation failed",
            errors=["temperature must be 0.0-2.0, got 3.0"],
        )
        print(error.errors)  # ["temperature must be 0.0-2.0, got 3.0"]
        ```

    Note:
        Arises when proposed config values violate parameter constraints
        or when YAML parsing fails. Should be caught and logged as a warning,
        with the original config preserved.
    """

    def __init__(
        self,
        message: str,
        *,
        errors: list[str] | None = None,
    ) -> None:
        """Initialize ConfigValidationError with context.

        Args:
            message: Human-readable error description.
            errors: List of individual validation errors.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling
            and prevent positional argument mistakes.
        """
        super().__init__(message)
        self.errors = errors or []

    def __str__(self) -> str:
        """Return string representation with errors.

        Returns:
            Formatted error message including list of validation errors.

        Note:
            Outputs formatted error message with validation errors list
            when available, preserving base message structure.
        """
        base = super().__str__()
        if self.errors:
            return f"{base} [errors={self.errors}]"
        return base

__init__

__init__(
    message: str, *, errors: list[str] | None = None
) -> None

Initialize ConfigValidationError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

errors

List of individual validation errors.

TYPE: list[str] | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling and prevent positional argument mistakes.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    errors: list[str] | None = None,
) -> None:
    """Initialize ConfigValidationError with context.

    Args:
        message: Human-readable error description.
        errors: List of individual validation errors.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling
        and prevent positional argument mistakes.
    """
    super().__init__(message)
    self.errors = errors or []

__str__

__str__() -> str

Return string representation with errors.

RETURNS DESCRIPTION
str

Formatted error message including list of validation errors.

Note

Outputs formatted error message with validation errors list when available, preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string representation with errors.

    Returns:
        Formatted error message including list of validation errors.

    Note:
        Outputs formatted error message with validation errors list
        when available, preserving base message structure.
    """
    base = super().__str__()
    if self.errors:
        return f"{base} [errors={self.errors}]"
    return base

InvalidScoreListError

Bases: ScoringError


              flowchart TD
              gepa_adk.domain.exceptions.InvalidScoreListError[InvalidScoreListError]
              gepa_adk.domain.exceptions.ScoringError[ScoringError]
              gepa_adk.domain.exceptions.EvolutionError[EvolutionError]

                              gepa_adk.domain.exceptions.ScoringError --> gepa_adk.domain.exceptions.InvalidScoreListError
                                gepa_adk.domain.exceptions.EvolutionError --> gepa_adk.domain.exceptions.ScoringError
                



              click gepa_adk.domain.exceptions.InvalidScoreListError href "" "gepa_adk.domain.exceptions.InvalidScoreListError"
              click gepa_adk.domain.exceptions.ScoringError href "" "gepa_adk.domain.exceptions.ScoringError"
              click gepa_adk.domain.exceptions.EvolutionError href "" "gepa_adk.domain.exceptions.EvolutionError"
            

Raised when score list is empty or contains non-finite values.

This exception is raised during acceptance score aggregation when the evaluation batch scores are empty or contain NaN/inf values that would invalidate acceptance decisions.

ATTRIBUTE DESCRIPTION
scores

The invalid score list that caused the error.

TYPE: list[float]

reason

Description of why the scores are invalid ("empty" or "non-finite").

TYPE: str

Examples:

Handling invalid score lists:

from gepa_adk.domain.exceptions import InvalidScoreListError

try:
    acceptance_score = aggregate_scores(scores)
except InvalidScoreListError as e:
    print(f"Invalid scores: {e.reason}, scores: {e.scores}")
Note

Arises when evaluation batch scores cannot be aggregated for acceptance. Empty batches or non-finite values would corrupt evolution decisions.

Source code in src/gepa_adk/domain/exceptions.py
class InvalidScoreListError(ScoringError):
    """Raised when score list is empty or contains non-finite values.

    This exception is raised during acceptance score aggregation when the
    evaluation batch scores are empty or contain NaN/inf values that would
    invalidate acceptance decisions.

    Attributes:
        scores (list[float]): The invalid score list that caused the error.
        reason (str): Description of why the scores are invalid ("empty" or
            "non-finite").

    Examples:
        Handling invalid score lists:

        ```python
        from gepa_adk.domain.exceptions import InvalidScoreListError

        try:
            acceptance_score = aggregate_scores(scores)
        except InvalidScoreListError as e:
            print(f"Invalid scores: {e.reason}, scores: {e.scores}")
        ```

    Note:
        Arises when evaluation batch scores cannot be aggregated for acceptance.
        Empty batches or non-finite values would corrupt evolution decisions.
    """

    def __init__(
        self,
        message: str,
        *,
        scores: list[float],
        reason: str,
        cause: Exception | None = None,
    ) -> None:
        """Initialize InvalidScoreListError with context.

        Args:
            message: Human-readable error description.
            scores: The invalid score list.
            reason: Why the scores are invalid ("empty" or "non-finite").
            cause: Original exception that caused this error.

        Note:
            Context fields use keyword-only syntax to ensure explicit labeling.
        """
        super().__init__(message, cause=cause)
        self.scores = scores
        self.reason = reason

    def __str__(self) -> str:
        """Return string with score list and reason.

        Returns:
            Formatted message including reason and score list preview.

        Note:
            Outputs formatted error message with reason and score list preview
            (first 5 scores), preserving base message structure.
        """
        base = super().__str__()
        score_preview = (
            str(self.scores[:5]) + "..." if len(self.scores) > 5 else str(self.scores)
        )
        return f"{base} [reason={self.reason!r}, scores={score_preview}]"

__init__

__init__(
    message: str,
    *,
    scores: list[float],
    reason: str,
    cause: Exception | None = None,
) -> None

Initialize InvalidScoreListError with context.

PARAMETER DESCRIPTION
message

Human-readable error description.

TYPE: str

scores

The invalid score list.

TYPE: list[float]

reason

Why the scores are invalid ("empty" or "non-finite").

TYPE: str

cause

Original exception that caused this error.

TYPE: Exception | None DEFAULT: None

Note

Context fields use keyword-only syntax to ensure explicit labeling.

Source code in src/gepa_adk/domain/exceptions.py
def __init__(
    self,
    message: str,
    *,
    scores: list[float],
    reason: str,
    cause: Exception | None = None,
) -> None:
    """Initialize InvalidScoreListError with context.

    Args:
        message: Human-readable error description.
        scores: The invalid score list.
        reason: Why the scores are invalid ("empty" or "non-finite").
        cause: Original exception that caused this error.

    Note:
        Context fields use keyword-only syntax to ensure explicit labeling.
    """
    super().__init__(message, cause=cause)
    self.scores = scores
    self.reason = reason

__str__

__str__() -> str

Return string with score list and reason.

RETURNS DESCRIPTION
str

Formatted message including reason and score list preview.

Note

Outputs formatted error message with reason and score list preview (first 5 scores), preserving base message structure.

Source code in src/gepa_adk/domain/exceptions.py
def __str__(self) -> str:
    """Return string with score list and reason.

    Returns:
        Formatted message including reason and score list preview.

    Note:
        Outputs formatted error message with reason and score list preview
        (first 5 scores), preserving base message structure.
    """
    base = super().__str__()
    score_preview = (
        str(self.scores[:5]) + "..." if len(self.scores) > 5 else str(self.scores)
    )
    return f"{base} [reason={self.reason!r}, scores={score_preview}]"