Exceptions
Everything the SDK raises on purpose is a KorchError subclass with a stable code — no raw
temporalio/httpx/dspy exception ever crosses a public boundary.
KorchError
KorchError(
message: str, *, code: str | None = None, **context: str
)
Bases: Exception
Base class for every error the SDK raises.
Catching KorchError catches everything the SDK can raise deliberately. Each instance
carries a stable code (from :mod:korchestrator.constants.error_codes, part of the
compatibility surface) and an optional context mapping of tenant-safe string fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
A human-readable, actionable message — what failed, which value was involved, and what to do. It MUST NOT contain secrets or a full prompt. |
required |
code
|
str | None
|
The stable error code. Defaults to the class's |
None
|
**context
|
str
|
Tenant-safe string fields describing the failure (e.g. |
{}
|
Example
from korchestrator.exceptions import KorchError, ValidationError err = ValidationError("Objective must be at least 10 characters.") err.code 'KORCH_VALIDATION_FAILED' isinstance(err, KorchError) True
Build the error with an actionable message, a stable code, and string context.
AuthError
AuthError(
message: str, *, code: str | None = None, **context: str
)
ValidationError
ValidationError(
message: str, *, code: str | None = None, **context: str
)
NetworkError
NetworkError(
message: str, *, code: str | None = None, **context: str
)
ProviderError
ProviderError(
message: str, *, code: str | None = None, **context: str
)
TimeoutError
TimeoutError(
message: str, *, code: str | None = None, **context: str
)
Bases: KorchError
An operation exceeded its deadline.
Deliberately shadows the builtin TimeoutError inside the package namespace; it subclasses
KorchError only. Import it explicitly (from korchestrator.exceptions import
TimeoutError) so the shadowing is visible at the import site.
RateLimitError
RateLimitError(
message: str, *, code: str | None = None, **context: str
)
QuotaExceededError
QuotaExceededError(
message: str, *, code: str | None = None, **context: str
)
RoutingError
RoutingError(
message: str, *, code: str | None = None, **context: str
)
GovernanceHaltError
GovernanceHaltError(
message: str, *, code: str | None = None, **context: str
)
RunFailedError
RunFailedError(
message: str, *, code: str | None = None, **context: str
)
RunTimeoutError
RunTimeoutError(
message: str, *, code: str | None = None, **context: str
)
ToolError
ToolError(
message: str, *, code: str | None = None, **context: str
)
Bases: KorchError
A tool invocation failed, was not found, or was denied.
The specific case is carried by code — TOOL_NOT_FOUND, TOOL_ACCESS_DENIED, or
NOT_IMPLEMENTED — which callers pass explicitly.
MissingExtraError
MissingExtraError(
message: str, *, code: str | None = None, **context: str
)
Bases: KorchError
An optional extra is required but not installed.
Raised at a lazy-import site instead of a bare ImportError; the message names the extra
and the exact pip install command.
Example
from korchestrator.exceptions import KorchError, MissingExtraError try: ... raise MissingExtraError( ... "The cognitive layer requires the 'dspy' extra. " ... "Install it with: pip install 'korchestrator[dspy]'" ... ) ... except KorchError as exc: ... print(exc.code) KORCH_MISSING_EXTRA
ConfigurationError
ConfigurationError(
message: str, *, code: str | None = None, **context: str
)
Bases: KorchError
Configuration is invalid: a bad value, range, enum, or mutually exclusive setting.