Skip to content

Errors

Catch KgliteDocsError for anything raised by the library. The concrete subclasses let you distinguish why a call failed.

from kglite_docs import KgliteDocsError, SelfVerificationError

try:
    corpus.verify_summary(sid, verdict="verified", verifier_agent_id="me")
except SelfVerificationError:
    # I authored this summary — get a different agent to verify
    ...
except KgliteDocsError as exc:
    # any other library-level failure
    ...

Exception hierarchy.

Catch KgliteDocsError for anything raised by this library. The concrete subclasses below are what callers reach for when they want to distinguish why a call failed.

KgliteDocsError

Bases: Exception

Base class for all kglite-docs errors.

IngestError

Bases: KgliteDocsError

Couldn't ingest a document — unsupported format, parse failure, missing source file, etc.

UnsupportedFormatError

Bases: IngestError

The file extension isn't one of our supported formats. Pass format= explicitly if you know better.

MissingSourceError

Bases: KgliteDocsError

A Document's recorded path doesn't exist on disk anymore. Typically surfaced from the OCR loop, which needs to render the page from the original file.

ReviewConflict

Bases: KgliteDocsError

Review-queue state-machine violation: trying to claim an in-review ticket, complete one you don't hold, etc.

SelfVerificationError

Bases: KgliteDocsError

An agent tried to verify its own summary. Verifications must come from a different agent.

GroundingError

Bases: KgliteDocsError

A check_grounding call against a target that doesn't exist or has no source chunks.

NotIndexedError

Bases: KgliteDocsError

search / compose_context on a corpus that has ready chunks but none embedded — call Corpus.index() (or ingest(embed=True)) first. Raised instead of silently returning [], which is indistinguishable from a query that genuinely has no matches.

InvalidEnumError

Bases: KgliteDocsError, ValueError

A string value isn't one of the allowed enum members. Subclasses ValueError too, so old except ValueError paths still work.

ConcurrencyError

Bases: KgliteDocsError

Multi-process write attempted on a single-writer .kgl.

SynthesisRequiredError

Bases: KgliteDocsError

conclude_study was called before a ledger-wide cross-chunk synthesis pass ran (synthesis_status == pending). Run study("synthesize", …) first, or pass acknowledge_no_synthesis=True to record an explicit, audited skip. Guards against a confident-incomplete conclusion — the happy path marking a study "done" while a whole class of cross-chunk finding is still unreachable.