MemPalace/mempalace · error · BackendError
pgvector backend requires a local palace path to anchor mism
Error message
pgvector backend requires a local palace path to anchor mismatch protection; pure-remote palaces (local_path=None) are not supported yet
What it means
The pgvector backend's only mismatch protection is the local marker file inside the palace directory. With palace.local_path=None (pure-remote/hosted mode) it can neither write nor validate the marker, so opening would silently drop protection against DSN/namespace drift — therefore it refuses loudly with BackendError. Remote marker storage for pure-remote palaces is tracked as follow-up work.
Source
Thrown at mempalace/backends/pgvector.py:1515
def get_collection(self, *args, **kwargs) -> PgVectorCollection:
palace, collection_name, create, options = self._normalize_args(args, kwargs)
config = _PgVectorConfig.from_options(options)
if palace.namespace and palace.namespace != config.namespace:
config = _PgVectorConfig(dsn=config.dsn, namespace=palace.namespace)
client = self._client(config)
if palace.local_path:
marker_path = self._marker_path(palace.local_path)
if os.path.isfile(marker_path):
self._validate_marker_target(palace, config)
elif not create:
raise PalaceNotFoundError(marker_path)
else:
# The local marker is this backend's only mismatch-protection
# anchor. With no local_path (pure-remote / hosted mode) we can
# neither write nor validate it, so opening would silently drop
# protection against DSN/namespace drift. Refuse loudly. A remote
# marker store for pure-remote palaces is tracked as a follow-up.
raise BackendError(
"pgvector backend requires a local palace path to anchor mismatch "
"protection; pure-remote palaces (local_path=None) are not "
"supported yet"
)
table = self._table_name(palace=palace, collection_name=collection_name, config=config)
if not create and not client.table_exists(table):
raise CollectionNotInitializedError(collection_name)
collection = PgVectorCollection(
backend=self,
client=client,
config=config,
palace=palace,
collection_name=collection_name,
table=table,
)
with self._lock:
self._collections_by_palace.setdefault(palace.id, []).append(collection)
return collectionView on GitHub (pinned to 06cb6987f0)
Solutions
- Provide a local palace directory (local_path set to a writable path) so the marker can anchor the palace.
- Until remote markers ship, keep a small local state dir per palace even in server deployments.
- Track the upstream remote-marker-store feature if pure-remote mode is required.
Example fix
# before palace = PalaceRef(name="notes", local_path=None) col = pgvector_backend.get_collection(palace, "notes") # after palace = PalaceRef(name="notes", local_path="/var/lib/mempalace/notes") col = pgvector_backend.get_collection(palace, "notes", create=True)
Defensive patterns
Strategy: validation
Validate before calling
if palace.local_path is None:
palace = PalaceRef(name=palace.name, local_path=default_state_dir(palace.name))
col = backend.get_collection(palace, "notes", create=True) Type guard
def supports_pgvector(palace) -> bool:
return palace.local_path is not None Try / catch
try:
col = backend.get_collection(palace, "notes")
except BackendError as e:
if "local palace path" in str(e):
raise RuntimeError("pgvector backend needs a local palace dir; set local_path") Prevention
- Always provision a small local state directory per palace, even in server deployments.
- Check palace.local_path before selecting the pgvector backend.
When it happens
Trigger: Constructing a PalaceRef with local_path=None and requesting the pgvector backend: backend.get_collection(PalaceRef(name="x", local_path=None), "notes").
Common situations: Server/hosted deployments that keep palace state only in Postgres; refactoring from a local path to a remote-only PalaceRef; early experiments with headless palaces.
Related errors
- facet_counts does not support local-only filters
- pgvector does not support maintenance kind {kind!r}
- update requires at least one of documents, metadatas, embedd
- query requires exactly one of query_texts or query_embedding
- ChromaBackend has been closed
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/0715701c096a6b8f.
Report an issue: GitHub.