Skip to content

Exceptions

All exceptions are exported from the top-level data_harness package.


MaxTurnsExceeded

data_harness.MaxTurnsExceeded

MaxTurnsExceeded(
    turns: int,
    last_response: NormalizedResponse | None = None,
)

Bases: DataHarnessError, RuntimeError

The loop reached max_turns without the model finishing.

Still a RuntimeError because it was one before the taxonomy existed and callers catch it that way.

Attributes:

Name Type Description
turns

How many turns ran before the limit was hit.

last_response

The final provider response, if available.

Source code in data_harness/core/exceptions.py
def __init__(self, turns: int, last_response: NormalizedResponse | None = None):
    self.turns = turns
    self.last_response = last_response
    super().__init__(f"Max turns exceeded: {turns}")

ToolNotFoundError

data_harness.ToolNotFoundError

ToolNotFoundError(message: str, *, code: str | None = None)

Bases: DataHarnessError, KeyError

A tool invocation named a tool that is not registered.

Source code in data_harness/core/exceptions.py
def __init__(self, message: str, *, code: str | None = None) -> None:
    super().__init__(message)
    if code is not None:
        self.code = code

SubagentRecursionError

data_harness.SubagentRecursionError

SubagentRecursionError(
    message: str, *, code: str | None = None
)

Bases: DataHarnessError, RuntimeError

A subagent tried to spawn another subagent.

Source code in data_harness/core/exceptions.py
def __init__(self, message: str, *, code: str | None = None) -> None:
    super().__init__(message)
    if code is not None:
        self.code = code