localvectordb.exceptions module

exception localvectordb.exceptions.BaseLocalVectorDBException

Bases: Exception

Base class for all LocalVectorDB exceptions.

exception localvectordb.exceptions.DatabaseError

Bases: BaseLocalVectorDBException

Raised for general database operation failures.

exception localvectordb.exceptions.DatabaseNotFoundError

Bases: DatabaseError, KeyError

Raised if the Database cannot be found

exception localvectordb.exceptions.MetadataFilterError

Bases: DatabaseError, ValueError

Raised when there’s an error in metadata filter specification or processing

exception localvectordb.exceptions.DuplicateDocumentIDError

Bases: DatabaseError, ValueError

Raised when inserting document(s) and the id(s) already exist

exception localvectordb.exceptions.IndexIntegrityError

Bases: DatabaseError

Raised when the SQLite rows and the FAISS index disagree in a way that corrupts query results – notably duplicate faiss_id values, which cause one vector to be attributed to two different documents.

Recover with lvdb db <name> repair.

exception localvectordb.exceptions.UnsupportedIndexOperationError

Bases: DatabaseError

Raised when an operation is not supported by the configured FAISS index type.

Most commonly: IndexHNSWFlat cannot remove vectors, so documents cannot be deleted or replaced in a database backed by it.

exception localvectordb.exceptions.DocumentNotFoundError(message: str, missing_ids: str | List[str] | None = None)

Bases: DatabaseError, KeyError

Raised when one or more requested documents cannot be found

__init__(message: str, missing_ids: str | List[str] | None = None)
exception localvectordb.exceptions.PatchConflictError(message: str, expected: str | None = None, actual: str | None = None)

Bases: DatabaseError

Raised when a document patch’s expect_hash precondition does not match the stored content_hash – i.e. the document changed since the caller read it.

This is a distinct outcome from “document not found” and “no-op”: the document exists and the ops are valid, but applying them would clobber a concurrent write. Surfaces as HTTP 409 on the server.

__init__(message: str, expected: str | None = None, actual: str | None = None)
exception localvectordb.exceptions.PatchError

Bases: DatabaseError, ValueError

Raised when a document patch’s ops cannot be applied: an unmatched or ambiguous find, an out-of-range or overlapping splice, or a malformed op.

The whole patch fails atomically – no partial write. Surfaces as HTTP 422 on the server.

exception localvectordb.exceptions.EmbeddingError

Bases: BaseLocalVectorDBException, RuntimeError

Raised when an embedding provider fails to generate embeddings.

exception localvectordb.exceptions.OllamaNotFoundError

Bases: EmbeddingError

Raised when Ollama is not installed or not running.

exception localvectordb.exceptions.ConfigurationError

Bases: BaseLocalVectorDBException, RuntimeError

Raised when configuration is invalid or inconsistent.

exception localvectordb.exceptions.ValidationError

Bases: BaseLocalVectorDBException, ValueError

Raised when there’s a validation error in input data

exception localvectordb.exceptions.ConnectionPoolError

Bases: BaseLocalVectorDBException

Raised when a database connection cannot be acquired from the pool.

exception localvectordb.exceptions.RerankerError

Bases: BaseLocalVectorDBException, RuntimeError

Raised when there’s an error in reranking operations.

exception localvectordb.exceptions.CursorError

Bases: BaseLocalVectorDBException

Base class for cursor-related errors.

exception localvectordb.exceptions.CursorExpiredError

Bases: CursorError

Raised when a cursor has expired or been closed.

exception localvectordb.exceptions.CursorExhaustedError

Bases: CursorError

Raised when attempting to fetch from an exhausted cursor.