windlass.core.exceptions¶
exceptions
¶
Exception hierarchy for Windlass.
Every error raised by the framework derives from :class:WindlassError, so
applications can wrap a whole Windlass call in a single except block::
from windlass import WindlassError
try:
rag.ask("...")
except WindlassError as exc:
log.error("windlass failed: %s", exc)
Errors carry structured context in :attr:WindlassError.context and render a
human-readable remediation hint whenever one is available. Windlass never lets a
raw :class:ImportError from an optional dependency reach user code — those are
translated into :class:MissingDependencyError with the exact pip install
command to run.
WindlassError
¶
Bases: Exception
Base class for every error raised by Windlass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Human readable description of what went wrong. |
required |
hint
|
str | None
|
Optional actionable remediation shown after the message. |
None
|
context
|
dict[str, Any] | None
|
Arbitrary structured detail (provider name, model, ids, ...). Useful for logging and for tests that assert on specifics. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
message |
The raw message without the hint appended. |
|
hint |
The remediation hint, if any. |
|
context |
dict[str, Any]
|
Structured detail about the failure. |
Example
raise WindlassError("boom", hint="try again", context={"attempt": 2}) Traceback (most recent call last): windlass.core.exceptions.WindlassError: boom
Hint: try again
Source code in src\windlass\core\exceptions.py
ConfigurationError
¶
ConfigurationError(
message: str, *, hint: str | None = None, context: dict[str, Any] | None = None
)
Bases: WindlassError
A component was configured with invalid or incomplete settings.
Source code in src\windlass\core\exceptions.py
MissingDependencyError
¶
MissingDependencyError(
feature: str,
*,
extra: str,
package: str | None = None,
original: BaseException | None = None
)
Bases: WindlassError
An optional dependency required by the requested feature is not installed.
Windlass keeps its core install tiny; every integration lives behind an optional dependency group. When a feature is used without its group being installed this error explains exactly which command fixes it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
str
|
Human readable feature name, e.g. |
required |
extra
|
str
|
The extras group to install, e.g. |
required |
package
|
str | None
|
The distribution that failed to import, for the context dict. |
None
|
original
|
BaseException | None
|
The underlying :class: |
None
|
Example
raise MissingDependencyError("Evaluation", extra="evaluation") Traceback (most recent call last): windlass.core.exceptions.MissingDependencyError: Evaluation is not installed.
Hint: Run: pip install "windlass[evaluation]"
Source code in src\windlass\core\exceptions.py
RegistryError
¶
Bases: WindlassError
Base class for component-registry problems.
Source code in src\windlass\core\exceptions.py
ComponentNotFoundError
¶
Bases: RegistryError
No component is registered under the requested name.
The message lists the available names so typos are obvious.
Source code in src\windlass\core\exceptions.py
DuplicateComponentError
¶
Bases: RegistryError
A component name is already taken and override=False.
Source code in src\windlass\core\exceptions.py
PluginError
¶
Bases: WindlassError
A third-party plugin failed to load or misbehaved during discovery.
Source code in src\windlass\core\exceptions.py
ProviderError
¶
ProviderError(
message: str,
*,
provider: str | None = None,
status_code: int | None = None,
hint: str | None = None,
context: dict[str, Any] | None = None,
original: BaseException | None = None
)
Bases: WindlassError
A backing provider (LLM, vector store, ...) returned an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
What went wrong. |
required |
provider
|
str | None
|
Which provider raised it. |
None
|
status_code
|
int | None
|
HTTP status, when the failure came from an HTTP call.
Pass this whenever you have it. Retry classification reads it
(see :func: |
None
|
hint
|
str | None
|
Actionable remediation. |
None
|
context
|
dict[str, Any] | None
|
Structured detail. |
None
|
original
|
BaseException | None
|
The underlying exception, kept for debugging. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
provider |
The provider name. |
|
status_code |
The HTTP status, when known. |
|
original |
The wrapped exception, when there was one. |
Example
err = ProviderError("upstream boom", provider="acme", status_code=503) from windlass.core.retry import is_retryable is_retryable(err) True
Source code in src\windlass\core\exceptions.py
AuthenticationError
¶
AuthenticationError(
message: str,
*,
provider: str | None = None,
status_code: int | None = None,
hint: str | None = None,
context: dict[str, Any] | None = None,
original: BaseException | None = None
)
Bases: ProviderError
Credentials are missing, expired, or rejected by the provider.
Source code in src\windlass\core\exceptions.py
RateLimitError
¶
Bases: ProviderError
The provider applied rate limiting or quota exhaustion.
Attributes:
| Name | Type | Description |
|---|---|---|
retry_after |
Seconds the provider asked us to wait, when advertised. |
Source code in src\windlass\core\exceptions.py
ProviderTimeoutError
¶
ProviderTimeoutError(
message: str,
*,
provider: str | None = None,
status_code: int | None = None,
hint: str | None = None,
context: dict[str, Any] | None = None,
original: BaseException | None = None
)
Bases: ProviderError
The provider did not answer within the configured timeout.
Source code in src\windlass\core\exceptions.py
ResponseError
¶
ResponseError(
message: str,
*,
provider: str | None = None,
status_code: int | None = None,
hint: str | None = None,
context: dict[str, Any] | None = None,
original: BaseException | None = None
)
Bases: ProviderError
The provider replied, but the payload could not be interpreted.
Source code in src\windlass\core\exceptions.py
MalformedToolCallError
¶
Bases: ResponseError
The model emitted a tool call the provider could not parse.
This is a model mistake, not a provider failure, and it is recoverable in
exactly the way a hallucinated tool name is: show the model what went wrong
and let it try again. :class:~windlass.agent.runtime.AgentRuntime catches
it and feeds :attr:feedback back into the conversation rather than ending
the run.
The commonest cause is a model trying to express a data dependency the
tool-calling protocol cannot represent — nesting one call inside another's
arguments, as in settle(amount=<function=compute>{...}</function>),
because the value it needs does not exist until the first call has run.
The protocol requires that to happen across two turns.
Attributes:
| Name | Type | Description |
|---|---|---|
raw |
The provider's rejected generation, when it reports one. Useful in logs; it is the only place the model's actual intent survives. |
Example
err = MalformedToolCallError("bad call", provider="groq", raw="
{") "one tool call at a time" in err.feedback True
Source code in src\windlass\core\exceptions.py
feedback
property
¶
The correction shown to the model so it can retry.
Written as an instruction rather than a stack trace, because the reader is a language model deciding what to emit next.
ValidationError
¶
Bases: WindlassError
User supplied data failed validation before reaching a provider.
Source code in src\windlass\core\exceptions.py
GuardrailViolation
¶
GuardrailViolation(
message: str,
*,
stage: str = "input",
rule: str | None = None,
detections: list[dict[str, Any]] | None = None
)
Bases: WindlassError
A guardrail blocked an input or an output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
What the guardrail objected to. |
required |
stage
|
str
|
|
'input'
|
rule
|
str | None
|
Identifier of the rule that fired. |
None
|
detections
|
list[dict[str, Any]] | None
|
Structured detail about each detection. |
None
|
Source code in src\windlass\core\exceptions.py
PipelineError
¶
Bases: WindlassError
A RAG or ingestion pipeline step failed.
Source code in src\windlass\core\exceptions.py
IngestionError
¶
Bases: PipelineError
A document could not be loaded, preprocessed, chunked or indexed.
Source code in src\windlass\core\exceptions.py
RetrievalError
¶
Bases: PipelineError
Retrieval failed or returned an unusable result.
Source code in src\windlass\core\exceptions.py
ToolError
¶
Bases: WindlassError
Base class for tool related failures.
Source code in src\windlass\core\exceptions.py
ToolNotFoundError
¶
Bases: ToolError
The model asked to call a tool that is not registered.
Source code in src\windlass\core\exceptions.py
ToolExecutionError
¶
Bases: ToolError
A tool raised while executing.
The original exception is preserved on :attr:original and as the
__cause__ of this error.
Source code in src\windlass\core\exceptions.py
AgentError
¶
Bases: WindlassError
The agent runtime could not complete the request.
Source code in src\windlass\core\exceptions.py
MaxIterationsExceeded
¶
Bases: AgentError
The agent hit its reasoning-step budget without producing an answer.
Source code in src\windlass\core\exceptions.py
InterruptedError_
¶
InterruptedError_(
message: str = "Execution paused for human approval.",
*,
payload: Any = None,
thread_id: str | None = None
)
Bases: AgentError
Execution paused for human review (human-in-the-loop interrupt).
Named with a trailing underscore to avoid shadowing the builtin
InterruptedError. Exported as AgentInterrupt from :mod:windlass.
Attributes:
| Name | Type | Description |
|---|---|---|
payload |
What the agent wants a human to approve or edit. |
|
thread_id |
Checkpoint thread that can be resumed. |
Source code in src\windlass\core\exceptions.py
MCPError
¶
Bases: WindlassError
An MCP server could not be reached or returned an error.
Source code in src\windlass\core\exceptions.py
EvaluationError
¶
Bases: WindlassError
An evaluation run or metric computation failed.
Source code in src\windlass\core\exceptions.py
MemoryError_
¶
Bases: WindlassError
A memory backend failed. Exported as WindlassMemoryError.
Source code in src\windlass\core\exceptions.py
SerializationError
¶
SerializationError(
message: str, *, hint: str | None = None, context: dict[str, Any] | None = None
)
Bases: WindlassError
State could not be serialised to or from a checkpoint.