Errors
The flexiq exception hierarchy — catch by specific type or by the FlexiQError base.
The flexiq exception hierarchy — catch by specific type or by the FlexiQError base.
Almost every exception flexiq raises extends FlexiQError, so a single
except can scope them; the specific subclasses let you branch on what went
wrong. Two exceptions sit outside the tree (noted below) — a blanket
except FlexiQError will not catch them.
from flexiq import FlexiQError, ResourceNotFoundError
try:
result = job.result(timeout=5)
except ResourceNotFoundError as exc:
# the message names the missing resource, e.g. "Resource 'db' is not registered"
print(exc)
except FlexiQError as exc:
report(exc)| Class | Extends | Raised when |
|---|---|---|
FlexiQError | Exception | Base — never raised directly. |
TaskTimeoutError | FlexiQError | A task exceeds its hard timeout. |
SoftTimeoutError | FlexiQError | A task exceeds its soft timeout (checked cooperatively via the context). |
TaskCancelledError | FlexiQError | A running task detects it has been cancelled. |
TaskFailedError | FlexiQError | Awaiting a job that failed or dead-lettered. Carries errtype, traceback, job_id, raw_error. |
MaxRetriesExceededError | FlexiQError | A task exhausts all retry attempts. Same failure details as TaskFailedError. |
SerializationError | FlexiQError | Serialization / deserialization or payload-integrity failure (e.g. a bad SignedSerializer signature). |
CryptoError | SerializationError | A payload codec (HmacCodec, AesGcmCodec) fails to decrypt or verify. |
InterceptionError | SerializationError | An argument interceptor rejects or misbehaves. |
CircuitBreakerOpenError | FlexiQError | A task's circuit breaker is open. |
RateLimitExceededError | FlexiQError | A task's rate limit is exceeded. |
JobNotFoundError | FlexiQError, KeyError | A job ID isn't found in storage. |
QueueError | FlexiQError | A queue-level operational error. |
NotesValidationError | FlexiQError, ValueError | A notes dict breaks the contract (>15 fields, >4 KiB, …). |
DuplicateTaskError | FlexiQError, ValueError | Two tasks claim one registered name — at @flexiq.task() decoration, or when a queue claims a declaration that collides with one it already holds. See Task discovery. |
TaskNotBoundError | FlexiQError, RuntimeError | A @flexiq.task() handle is submitted before any queue claimed it. Construct the Queue, call autodiscover(), or start the worker first. |
PredicateRejectedError | FlexiQError | An enqueue-time predicate cancelled the submission. Carries task_name, reason. |
BatchPartialFailureError | TaskFailedError | A batch task where some items failed. |
ResourceError | FlexiQError | Base for resource dependency-injection errors. |
ResourceInitError | ResourceError | A resource factory fails during initialization. |
ResourceUnavailableError | ResourceError | A resource is permanently unhealthy and can't be resolved. |
CircularDependencyError | ResourceError | Resource dependencies form a cycle. |
ResourceNotFoundError | ResourceError, KeyError | Resolving a resource name that was never registered. |
ProxyReconstructionError | ResourceError | A proxy handler fails to reconstruct an object from its recipe. |
ProxyCleanupError | ResourceError | A proxy handler fails during cleanup. |
FlexiQError tree| Class | Extends | Import from | Raised when |
|---|---|---|---|
LockNotAcquiredError | Exception | flexiq.locks | queue.lock(...) can't acquire a held lock. |
BatchResultTypeError | TypeError | flexiq | A batch result is read as the wrong type. |
The KeyError / ValueError / TypeError mix-ins keep existing
except KeyError / except ValueError clauses working when these are raised
inside enqueue or lookup paths.
See error handling for retry / timeout / dead-letter behavior around a failing task.