MemPalace/mempalace · error · BackendMismatchError

qdrant marker does not identify the qdrant backend

Error message

qdrant marker does not identify the qdrant backend

What it means

Raised during marker validation when the marker file parses but its "backend" field does not equal "qdrant". The marker exists to prevent one backend from operating on a palace created by another backend (e.g. chromadb artifacts opened via qdrant); a foreign or malformed marker aborts the open.

Source

Thrown at mempalace/backends/qdrant.py:1245

    def _read_marker(self, palace: PalaceRef) -> Optional[dict]:
        if not palace.local_path:
            return None
        marker_path = self._marker_path(palace.local_path)
        if not os.path.isfile(marker_path):
            return None
        try:
            with open(marker_path, encoding="utf-8") as f:
                marker = json.load(f)
        except (OSError, json.JSONDecodeError) as exc:
            raise BackendMismatchError(f"qdrant marker is unreadable: {marker_path}") from exc
        return marker if isinstance(marker, dict) else {}

    def _validate_marker_target(self, palace: PalaceRef, config: _QdrantConfig) -> None:
        marker = self._read_marker(palace)
        if marker is None:
            return
        if marker.get("backend") != self.name:
            raise BackendMismatchError("qdrant marker does not identify the qdrant backend")
        expected = self._marker_target(palace, config)
        actual = marker.get("qdrant")
        if not isinstance(actual, dict):
            raise BackendMismatchError("qdrant marker is missing remote target metadata")
        mismatched = [
            key for key, expected_value in expected.items() if actual.get(key) != expected_value
        ]
        if mismatched:
            details = ", ".join(mismatched)
            raise BackendMismatchError(
                "qdrant marker remote target does not match current configuration "
                f"({details}); keep MEMPALACE_QDRANT_URL and namespace consistent "
                "or use a fresh palace directory"
            )

    def _write_marker(self, palace: PalaceRef, config: _QdrantConfig) -> None:
        if not palace.local_path:
            return

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Check which backend the palace was created with (read the marker's backend field) and open the palace with that backend
  2. If the palace should be migrated to qdrant, export data with the original backend and re-ingest into a fresh qdrant palace
  3. If the marker is simply wrong/stale and no other backend's data exists, delete the marker and re-create with create=True

Example fix

// before
backend = get_backend("qdrant")
col = backend.get_collection(palace, "drawers")  # marker says backend=chromadb
// after
backend = get_backend(marker["backend"])  # open with the owning backend
col = backend.get_collection(palace, "drawers")
Defensive patterns

Strategy: validation

Validate before calling

import json
def owning_backend(palace_path: str, marker_name: str) -> str | None:
    try:
        with open(os.path.join(palace_path, marker_name), encoding="utf-8") as f:
            return json.load(f).get("backend")
    except (OSError, json.JSONDecodeError):
        return None
# open palace only with owning_backend(palace_path, marker)

Try / catch

from mempalace.backends.base import BackendMismatchError
try:
    backend.get_collection(palace, name)
except BackendMismatchError as e:
    if "does not identify" in str(e):
        switch_to_marker_backend()  # reopen with the backend named in the marker

Prevention

When it happens

Trigger: Opening a palace directory via the qdrant backend when the marker was written by a different backend implementation, when the marker JSON was hand-edited, or when an old marker format lacked the backend field (marker.get("backend") returns None).

Common situations: User switched MEMPALACE_BACKEND (or equivalent config) from chromadb to qdrant while reusing the same palace directory; marker file rewritten by a tool; palace directory created by a much older version of mempalace before markers carried a backend field.

Related errors


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