MemPalace/mempalace · error · BackendMismatchError

qdrant marker remote target does not match current configura

Error message

qdrant marker remote target does not match current configuration ({details}); keep MEMPALACE_QDRANT_URL and namespace consistent or use a fresh palace directory

What it means

Raised when the marker's stored remote target (URL/namespace) differs from the current configuration. This is deliberate drift protection: a local palace pinned to Qdrant server A must not silently read/write Qdrant server B. The message lists the mismatched keys and advises keeping MEMPALACE_QDRANT_URL and the namespace consistent or using a fresh palace directory.

Source

Thrown at mempalace/backends/qdrant.py:1255

            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
        os.makedirs(palace.local_path, exist_ok=True)
        try:
            os.chmod(palace.local_path, 0o700)
        except (OSError, NotImplementedError):
            pass
        marker = {
            "backend": self.name,
            "schema_version": 1,
            "created_at": _utcnow(),
            "palace_id": palace.id,

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Restore the original MEMPALACE_QDRANT_URL/namespace values recorded in the marker file so they match the palace
  2. If the change is intentional, use a fresh palace directory for the new target (or delete the marker and recreate with create=True after verifying the remote collection)
  3. Read the marker file to see exactly which keys (url, namespace) mismatch and align config accordingly

Example fix

# before
export MEMPALACE_QDRANT_URL=http://qdrant-b:6333  # marker pins qdrant-a
col = backend.get_collection(palace, "drawers")  # raises BackendMismatchError
# after
export MEMPALACE_QDRANT_URL=http://qdrant-a:6333  # match the pinned target
col = backend.get_collection(palace, "drawers")
Defensive patterns

Strategy: validation

Validate before calling

import json, os
def config_matches_marker(palace_path: str, url: str, namespace: str, marker_name: str) -> bool:
    try:
        with open(os.path.join(palace_path, marker_name), encoding="utf-8") as f:
            target = json.load(f).get("qdrant", {})
    except (OSError, json.JSONDecodeError):
        return False
    return target.get("url") == url and target.get("namespace") == namespace

Try / catch

from mempalace.backends.base import BackendMismatchError
try:
    backend.get_collection(palace, name)
except BackendMismatchError as e:
    if "does not match current configuration" in str(e):
        load_env_for_palace(palace)  # restore pinned URL/namespace or pick fresh dir

Prevention

When it happens

Trigger: MEMPALACE_QDRANT_URL or MEMPALACE_QDRANT_NAMESPACE (or the per-palace namespace) changed between sessions while reusing the same local palace directory; also when a per-palace config overrides the namespace so the computed expected target diverges from the marker.

Common situations: Switching between local and hosted Qdrant (localhost:6333 vs cloud URL); changing namespace to partition environments (dev/prod) but reusing a palace directory; copying a palace directory to another machine with different env vars; CI using a different namespace than the developer's machine.

Related errors


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