Errors
PyAIStack raises package-specific exceptions for invalid input, unavailable providers, loaders, and vector stores.
Use format_error() at the application boundary to show a concise Python-style error that points to your code rather than PyAIStack internals.
from pyaistack import RAG, format_error
from pyaistack.exceptions import AIStackError
try:
rag = RAG()
rag.add(["A document to index."])
except AIStackError as error:
print(format_error(error))
Common exceptions:
ProviderError— Ollama or another model provider failed.EmptyIndexError— a search was requested before documents were indexed.LoaderError— a file cannot be read or is empty.UnsupportedFileTypeError— a requested loader type is not implemented.ChunkingError— chunk size, overlap, or input is invalid.VectorStoreError— vector validation or persistent-store work failed.VectorStoreSchemaError— a PostgreSQL/pgvector schema, dimension, constraint, or required index is incompatible.VectorStoreConnectionError— a PostgreSQL connection could not be acquired.VectorStoreTimeoutError— PostgreSQL cancelled an operation after its configured statement timeout.VectorStoreConstraintError— a PostgreSQL write violated a database constraint.
Database errors preserve their chained driver exception for debugging, while normal PostgreSQL store messages exclude DSNs, credentials, document content, metadata values, and vectors. See PostgreSQL + pgvector.