cadrumo.adapters.outbound.llm.errors module¶
Error hierarchy for the LLM subpackage.
All public LLM exceptions inherit from
LLMError, which extends
CadrumoError. Provider adapters surface
LLMProviderError and
LLMRateLimitError, cache and usage storage
surface LLMCacheError, and strict model
validators surface LLMValidationError.
- exception LLMError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
CadrumoErrorBase exception for public LLM package failures.
- Parameters:
- Return type:
None
- code¶
- exception LLMProviderError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
LLMErrorRaised when a provider adapter cannot return a completion.
- Parameters:
- Return type:
None
- code¶
- exception LLMTransientTransportError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
LLMProviderErrorRaised when a dispatch failed on the way to the model, not at it.
A connection refused or reset while the runtime loads a model, a 5xx from the runtime, a read timeout on a model still coming up: the request never produced an answer, and the same request sent again may well produce one.
Split out of
LLMProviderErrorbecause that class covers both directions and the retry decision needs them apart. A 4xx and a malformed 2xx body are deterministic – the identical request fails identically forever – so retrying them burns the budget and delays the real refusal. Retryability is declared once, on the registeredErrorCodefor each class, and the transport reads it from there rather than keeping a second list of its own.A subclass rather than a sibling, so every existing
except LLMProviderErrorhandler keeps catching it: the split refines the boundary, it does not move it.- Parameters:
- Return type:
None
- code¶
- exception LLMPdfRasterisationError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
LLMErrorRaised when
rasterise_pdf_pages_to_base64_png()fails.- Parameters:
- Return type:
None
- code¶
- exception LLMCacheError(message=None, *, context=None, translated_message=None)[source]¶
Bases:
LLMErrorRaised when
LLMCachestorage fails.- Parameters:
- Return type:
None
- code¶
- exception LLMRateLimitError(message=None, retry_after_seconds=None, *, context=None, translated_message=None)[source]¶
Bases:
LLMProviderErrorRaised when a provider rejects a request because of rate limits.
Inherits from
LLMProviderErrorso callers can catch all provider-boundary failures together.- Parameters:
- Return type:
None
- code¶
- exception LLMConfigError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]¶
Bases:
TerminalPreconditionErrorMixin,LLMErrorRaised when
LLMClientconfiguration is invalid.- Parameters:
- Return type:
None
- code¶
- exception LLMContentionError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]¶
Bases:
TerminalPreconditionErrorMixin,LLMErrorRaised when this machine has no measured headroom to load the model.
The other half of admission control, and a different question from
LLMBusyError. Occupancy asks how many loads are already running; this asks whether ONE load fits right now, measured against free memory rather than counted. Both can refuse while the other would admit.Fails closed on an unreadable figure, because “could not tell” is not evidence of headroom and is precisely the state that destroys running work on a machine with no spare device memory.
Never retryable. The condition does not decay on a timer – it decays when the load on the machine changes – so re-sending on a schedule turns one refusal into several while the memory it is waiting for is still held.
- Parameters:
- Return type:
None
- code¶
- exception LLMBusyError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]¶
Bases:
TerminalPreconditionErrorMixin,LLMErrorRaised when an on-host inference slot is not free and the request is refused.
The admission half of the local-resource boundary, and deliberately NOT a subclass of
LLMProviderError: nothing failed, and no request reached a runtime. The machine is already running as much inference as it was configured to run at once, and a second concurrent load on consumer hardware is an out-of-memory kill that takes the FIRST read down with it.Distinct from a contention refusal, which reports measured headroom against one model’s requirement. This one reports occupancy: the arena is full regardless of what the figures say, because two loads that each fit individually still do not fit together.
- Parameters:
- Return type:
None
- code¶
- exception LLMConsentError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]¶
Bases:
TerminalPreconditionErrorMixin,LLMErrorRaised when an off-host read of taxpayer evidence is refused.
Deliberately NOT a subclass of
LLMConfigError. A configuration fault says “you routed this wrongly”; this says “you may not send this document off this host”, and a caller catching configuration faults to retry at another provider must not silently swallow a confidentiality refusal (sensitive-financial-data-secure-storage-only).- Parameters:
- Return type:
None
- code¶
- exception LLMValidationError(message=None, *, context=None, translated_message=None, precondition_verdict=None)[source]¶
Bases:
TerminalPreconditionErrorMixin,LLMErrorRaised when an LLM-related object fails validation.
Pydantic field validators translate this registered error to a plain
ValueErrorat their callback boundary while preserving the registered error as the cause. Provider and parsing code keeps the typedLLMErrorhierarchy.- Parameters:
- Return type:
None
- code¶