MemPalace/mempalace · error · BackendError

pgvector query failed: {exc}

Error message

pgvector query failed: {exc}

What it means

Error "pgvector query failed: {exc}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/backends/pgvector.py:552

    def _execute(self, sql: str, params=None, *, fetch: bool = False, many: bool = False):
        with self._lock:
            conn = self._connect()
            try:
                with conn.cursor() as cur:
                    if many:
                        cur.executemany(sql, params or [])
                        rows = None
                    else:
                        cur.execute(sql, params or [])
                        rows = cur.fetchall() if fetch else None
                conn.commit()
            except Exception as exc:  # noqa: BLE001 - normalize to BackendError
                try:
                    conn.rollback()
                except Exception:  # pragma: no cover - rollback best effort
                    pass
                raise BackendError(f"pgvector query failed: {exc}") from exc
        return rows

    def ping(self) -> None:
        self._execute("SELECT 1", fetch=True)

    def ensure_extension(self) -> None:
        try:
            self._execute("CREATE EXTENSION IF NOT EXISTS vector")
        except BackendError:
            # Extension may already exist or require elevated privilege; the
            # table create will fail loudly later if the vector type is absent.
            logger.debug("pgvector CREATE EXTENSION skipped", exc_info=True)

    def table_exists(self, table: str) -> bool:
        rows = self._execute(
            "SELECT 1 FROM information_schema.tables "
            "WHERE table_schema = current_schema() AND table_name = %s",
            [table],

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Inspect the underlying psycopg error; verify the table exists, the pgvector extension is installed, and dimensions match

When it happens

Trigger: Thrown at mempalace/backends/pgvector.py:552 when the library encounters an invalid state.

Common situations: A query against the pgvector table failed (missing extension, wrong dimension, or dropped table).


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/449ee19faab66cff. Report an issue: GitHub.