Skip to content

Errors and Failures

A detent::Reader fails loudly in one place, opening. Every lookup after that returns the caller’s fallback on any error, and lookup reports the status that explains it. Distribution failures stay in the agent and never disturb readers.


detent::Reader(store, publisher_uid, namespaces, mapping_bytes) throws detent::ReaderError when the open fails; status() gives the detent_status and what() reads detent_open: <status name>. Python raises detent.ReaderError with .status, and Rust’s Reader::open returns Err(ReaderError { status }).

A store that doesn’t exist yet opens: lookups return the fallback with UNAVAILABLE until a generation appears. An untrusted directory, such as one that is group- or world-writable or not owned by publisher_uid, is UNTRUSTED.


get and get_as return the fallback for any status but OK; lookup returns the status with the value. The C names are DETENT_<NAME> in include/detent/reader.h.

StatusCause
OKThe value was read
MISSINGThe generation doesn’t hold the knob
INVALID_NAMEThe name doesn’t follow the naming rule
NOT_OPENEDThe namespace is outside the handle’s list
SOURCE_FAILUREThe generation failed verification
UNAVAILABLENo prepared generation for this namespace yet
UNTRUSTEDOwnership, mode, ACL or ancestry refused
INVALID_ARGUMENTA malformed argument
NO_MEMORYAn allocation, or the reader’s memory budget, refused
IOA system call failed

get_as<T> (get_as in Rust, get_bool in Python) also returns the fallback for a value that doesn’t fit T, such as a value other than 0 or 1 for bool; lookup reports that read as OK with the stored value.

Any value other than OK, known or not, is an error: a newer library may add statuses. Python maps an unknown one to an UNKNOWN_<n> member of Status, and Rust to Status::Unknown(n).

Lookup failures are never cached. If a knob is missing now and published a second later, the next read after the agent publishes finds it.


detent get prints the value and exits 0, or prints ERR <reason> to stderr and exits 1. --default VALUE prints VALUE instead for a missing knob or no generation yet; it doesn’t mask a generation that fails verification, or no source configured. See detent.


FailureBehaviorState afterwards
Untrusted store directoryThe open throws UNTRUSTEDNo reader
No generation yetLookups return the fallback with UNAVAILABLEUsable, retried at most once per 200 ms
A new generation fails to attachKeep answering from the installed viewLast known good
The agent loses the authorityThe agent retries; readers keep the selected generationLast known good
Missing knob readReturn the fallback with MISSINGUnchanged
Value that doesn’t fit get_as<T>Return the fallbackUnchanged

The guiding rule: distribution is control-plane work, serving is data-plane work. A distribution failure never adds I/O to a warm read and never erases a known-good configuration.


The durable authority reports each transaction’s outcome, such as applied or conflict, in its response. Some failures return a status code and a JSON body instead, such as 503 with {"error":"outcome_unknown"}. The Authority API documents both.