Errors¶
Every failure mode in denckring is one of these. None of them is silent: each carries
a stable code, a human-readable message, and a detail() dict for a caller that
would rather not parse English out of the message.
Each is importable from denckring itself (from denckring import InvalidParams),
and this page documents them from there: that is the path under the README's
stability promise, and denckring.core.errors, where they are defined, is not. A
class keeps its name, its place under DenckringError and its code; the message
wording may change.
denckring.DenckringError ¶
Bases: Exception
Base class for every error the library raises.
code is a stable string rather than the class name, so renaming a class
does not break a client reading the JSON. to_dict is what an agentic
caller sees instead of a traceback.
denckring.MissingCapability ¶
MissingCapability(
procedure_id: str, lang: str, capability: str
)
denckring.UnknownDevice ¶
UnknownDevice(
device_id: str, available: list[str] | None = None
)
Bases: DenckringError
denckring.UnsettablePhrase ¶
UnsettablePhrase(syllables: int, covered: list[int])
Bases: DenckringError
denckring.InputTooLong ¶
InputTooLong(
procedure_id: str,
given: int,
limit: int,
unit: str = "letters",
)
Bases: DenckringError
A generator that searches refuses input it cannot search in reasonable time.
Raised rather than returning a poor result, so a caller learns the limit instead of silently receiving something the procedure could not really do.
unit names what was counted, and defaults to what every caller
counted when this was written. proteus_verse rearranges words, and
a message telling its caller it can rearrange nine letters would be
precisely and confidently wrong about the limit it just hit.
denckring.TextTooLong ¶
TextTooLong(given: int, limit: int)
Bases: DenckringError
A service boundary refuses text past a configured size, defense in
depth alongside each procedure's own algorithmic fixes (review P2-06) —
not a claim that the library itself is bounded; check()/apply()
called directly have no such limit.
denckring.InputTooShort ¶
InputTooShort(procedure_id: str, needed: str, found: str)
Bases: DenckringError
The input could not feed the procedure.
The counterpart to InputTooLong, and the honest form of what four
generators used to do instead: return the input unchanged, which reads
exactly like a procedure that ran and had no effect. needed and found
are separate fields rather than one sentence, so a caller reading the JSON
learns what to change without parsing English out of message.
Raised wherever a generator has too few units to work on, whatever the unit
is — lines, sentences, words, slots, entries. That is deliberately one code
rather than a per-procedure choice: a caller retrying on input_too_short
should not have to know that spoonerism once called two-few-words
something else. NoCandidateWord keeps the narrower meaning it was built
for: enough units were present and none of them was suitable.
denckring.DegenerateOutput ¶
DegenerateOutput(
procedure_id: str, observed: str = IDENTICAL
)
Bases: DenckringError
apply produced its own input, its input's letters again, or nothing at all.
Raised rather than returned, for the reason diastic raises
NoCandidateWord rather than returning "": handing back text that
misrepresents what the procedure did is the failure, not a mild version of
success. Usually it means the input could not feed the procedure.
One error for these observations, because a caller cannot act very
differently on them — each means the returned text says nothing about what
the procedure did. IDENTICAL, COPY and EMPTY are waived by the same
allow_identity; NOTHING is not — see below. The empty case is the more
dangerous of the two waivable ones: BaseProcedure._report scores an empty
text 1.0, so melting_text returning "" was a satisfied report on a text
that was never written.
The message says what was observed and stops there. It does not say the
procedure did not run, because the guard cannot tell that from a procedure
that ran and drew the identity — which is not a corner case:
recombination on two sentences draws the identity permutation for half of
all seeds, and boustrophedon turning 'aba' recovers 'aba'. Claiming
the stronger thing would be this class committing the fault it exists to
catch.
NOTHING is the one exception to that carefulness, and to the waiver:
_produce returning [] is not a candidate the procedure judged and
rejected, it is the procedure returning no candidate at all, so apply
raises this directly rather than through _guard_degenerate — before
allow_identity is even consulted. allow_identity exists for a caller
who wants the degenerate-but-real result a procedure found; an empty list
is not a result, so there is nothing for that flag to waive.
denckring.NoCandidateWord ¶
NoCandidateWord(
procedure_id: str, reason: str | None = None
)
Bases: DenckringError
A generator that needs a real word refuses rather than returning none.
Raised rather than returning text with no candidate in it: silence there
would let a caller believe something had been produced when nothing was
available to produce it from. reason names what, specifically, offered
nothing — a lexicon swap for paragram, a source word for diastic and
mesostic — because "no candidate word" alone does not say what a caller
should do differently. Left unset, the message is paragram's original
one, the first and for a while the only caller.
LEXICON_DEFAULT
class-attribute
instance-attribute
¶
LEXICON_DEFAULT = "found no one-letter swap of any word into a word the lexicon knows. Try a different text, or check it instead of generating from it."
detail ¶
detail() -> dict[str, Any]
reason is in here, not only inside message.
The whole point of giving this error a reason was that an agentic caller
learns the true cause — a source word for diastic, a lexicon swap for
paragram — and a caller reading the JSON could reach it only by parsing
English out of message, which is the thing to_dict exists to avoid.
denckring.MalformedDevice ¶
MalformedDevice(path: str, reason: str)
Bases: DenckringError
A device file exists under a valid id, but its content cannot be read.
Raised instead of letting the underlying YAML or Pydantic error escape.
Both quote fragments of the file's own content in their default message
— harmless for a device this package ships, not harmless for one read
from DENCKRING_DEVICE_PATH, which is arbitrary user-authored YAML.
reason is deliberately short and holds nothing read from the file
itself: a parser exception's class name, or a count of validation
errors, never a value out of the document.
denckring.MalformedFigure ¶
MalformedFigure(path: str, reason: str)
Bases: DenckringError
The same failure mode as MalformedDevice, for a figure file.
denckring.UnknownFigure ¶
UnknownFigure(
figure_id: str, available: list[str] | None = None
)
Bases: DenckringError
denckring.UnknownLevel ¶
UnknownLevel(
figure_id: str, level: str, available: list[str]
)
Bases: DenckringError
denckring.NotConstructive ¶
NotConstructive(procedure_id: str)
Bases: DenckringError
Asked to generate with a procedure that only checks.
The MCP tool built this dict by hand and returned it, which meant one
failure mode in this package was not a DenckringError and could not be
caught with the others. kind says whether the form admits a generator;
constructive in describe says whether this install has one.
denckring.NoPromptHint ¶
NoPromptHint(procedure_id: str, lang: str)
Bases: DenckringError
A prompt hint was asked for in a language the row has none in.
describe falls back to English and names the substitution in
untranslated. prompt_hint returns a bare string with no channel to say
so, and a prompt in the wrong language is a different prompt, so it refuses
rather than falling back (ADR 0050).
denckring.UnsetHintParameter ¶
UnsetHintParameter(procedure_id: str, param: str)
Bases: DenckringError
A hint names a parameter whose value, after validation, is None.
None is a real value to a checker — "inferred from the text" — and is
valid there, so this is not InvalidParams. It is only a sentence that
cannot be written: the hint states the value, and there is none to state
(ADR 0050).
denckring.NotWordLocal ¶
NotWordLocal(
procedure_id: str,
scope: str,
unset: list[str] | None = None,
)
Bases: DenckringError
admits or witness was asked of a row that does not judge each word alone.
Answering anyway would be a guess: on a line-scoped row a word has no verdict
of its own, and on a tautogram with its initial unset the verdict on a word
depends on the text's first. unset names the parameters whose stating would
make the row word-local, so a caller knows whether a retry can work.