Skip to content

Type Alias: DocumentVersionErrorCode

@kortexya/reasoninglayer


@kortexya/reasoninglayer / DocumentVersionErrorCode

DocumentVersionErrorCode = "previous_document_not_found" | "duplicate_document_version_conflict"

Defined in: src/types/ingestion.ts:2244

The code of a document-version refusal of POST /api/v1/ingest/markdown and POST /api/v1/ingest/document.

  • 'previous_document_not_found' (HTTP 404, NotFoundError) — the previousDocumentId names no document of this tenant, or is not a UUID. Nothing is ingested.
  • 'duplicate_document_version_conflict' (HTTP 409, ConstraintViolationError) — the bytes were already ingested as a document that already has other versions, so it cannot also become the next version of previousDocumentId.

On an asynchronous ingest (sync: false) the same refusal ends the session document as failed with that message instead.

try {
await client.ingestion.ingestMarkdown({ content, config: { previousDocumentId } });
} catch (e) {
const code = errorBodyCode(e);
if (code === 'previous_document_not_found') console.warn('the previous version is gone');
}