Errors¶
Only these errors cross a public boundary (RULES C5). Each has a stable code, and to_info() gives its serializable ErrorInfo. Outcomes and errors explains the taxonomy.
The HarnessWeaver error taxonomy (RULES C5). See harnessweaver.core.errors.
BoundViolation ¶
BudgetExceeded ¶
DeadlineExceeded ¶
ErrorCode ¶
Bases: StrEnum
Stable, language-neutral error codes.
ErrorInfo ¶
Bases: BaseModel
The serializable form of an error, as carried by hook events and the wire API.
ExpressionError ¶
ExpressionEvalError ¶
Bases: ExpressionError
A cel-lite expression failed at evaluation time (missing key, type mismatch, ...).
ExpressionSyntaxError ¶
HarnessError ¶
IncompatibleContract ¶
InternalError ¶
LevelTooLow ¶
LockViolation ¶
ModelRefusal ¶
ModelRefusal(
message: str = "the model declined the request",
*,
response: ModelResponse | None = None,
**details: JsonValue,
)
Bases: RunBlocked
The model declined the request, or a content filter cut its answer short.
Providers raise this, with the code model_refusal, instead of returning the
answer. A declined call still costs tokens, so response carries its usage and
cost for the run to count, without its text (R9).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Never the model's own words (R9). |
'the model declined the request'
|
response
|
ModelResponse | None
|
What the call used. Leave its text empty. |
None
|
**details
|
JsonValue
|
Extra details, such as the refusal's |
{}
|
NotFound ¶
PluginConflict ¶
PluginNotAllowed ¶
PolicyDenied ¶
ProviderError ¶
RunBlocked ¶
RunEscalated ¶
RunInterrupted ¶
Bases: HarnessError
A hook stopped the run with Block, Escalate or Suspend (ADR-0020).
In run style the harness turns these into the run's status. In session style they are raised to the app's code, which may catch them.
RunSuspended ¶
SpecError ¶
ToolError ¶
UnknownProvider ¶
UnreachableHook ¶
ValidationFailed ¶
classify ¶
classify(exc: BaseException) -> HarnessError
Translate any exception into the taxonomy, defaulting to InternalError.
from_known ¶
from_known(exc: BaseException) -> HarnessError | None
Translate a well-known exception into the taxonomy, or return None.
Adapters call this first and fall back to InternalError.