init_vectorstore_table is not idempotent - it runs raw CREATE TABLE (no IF NOT EXISTS) and raises DuplicateTableError, wrapped by SQLAlchemy as ProgrammingError (SQLSTATE 42P07). overwrite_existing=True is destructive (DROP+CREATE), not “create if missing.”
Recommended pattern:
Bootstrap once (migration / init-db command), then on every run open the existing table with PGVectorStore.create_sync(...) - its docstring literally says “Name of an existing table.”
If you must keep init in app startup, pre-check with SELECT to_regclass('"schema"."table"') (returns NULL if absent) and only call init_vectorstore_table when missing. Narrow the except to ProgrammingError with SQLSTATE 42P07 to cover the concurrent-init race - never bare Exception (it swallows connection/permission/typo bugs).
Also flagged: docstring claims content_column default is "page_content" but the signature default is "content" - pick one and pass it to both init_vectorstore_table and PGVectorStore.create_sync or you’ll hit “column does not exist” errors.