All public errors are metrana exception types — the underlying Rust engine’s own exception types never
escape the API. They share a common base, so you can catch broadly or narrowly.
The run fails to initialize — connection failure or init timeout.
MetranaRunAlreadyExistsError
Under resume_strategy="never", the run exists and can’t be confirmed to belong to this job. The message carries the run path and (when reported) the existing run’s creation time.
MetranaOrchestrationIdMismatchError
The existing run carries a different orchestration id — definitive proof it belongs to a different job launch. Subclasses MetranaRunAlreadyExistsError, so existing handlers still catch it.
import metrana
from metrana.utils.exceptions import MetranaRunAlreadyExistsError
A logged metric or attribute is rejected as invalid (bad name, scale, points, step, episode, …). Raised synchronously from the log* call — validation is the enqueue boundary.
MetranaEventQueueFullError
The send queue is full and backpressure_strategy="raise".
Surfaces accumulated background sender errors — the generic logging-runtime failure. Under delivery_policy="all_or_crash", a logger stopped by a delivery failure surfaces this on the next log / flush / close.
MetranaTimeoutError
A blocking call (e.g. flush) timed out before its data became durable. Distinct from loss — nothing was dropped; the data is still in flight, so a later flush/close (given time, ideally a disk spool) can still deliver it.
MetranaClosingError
close / shutdown_logger deadline elapsed with data still not durable (neither acknowledged nor on the spool) — likely loss.
MetranaTimeoutError is benign. Treat it as “not yet durable”, not “lost” — re-flush or close
later. Pair with a disk spool and generous timeouts for strong guarantees (see
Lifecycle → sizing timeouts).
MetranaSenderError / MetranaClosingError mean likely loss. They are the loud failure the
all_or_crash default is designed to produce instead of silently dropping data. A
disk spool is what turns most of these into a transparent failover.
The exception types live in metrana.utils.exceptions if you want to import and catch specific ones.