MemPalace/mempalace · error · PalaceNotFoundError

{palace_path}

Error message

{palace_path}

What it means

A KeyError (with message) from get_adapter: the adapter class lookup failed while getting a long-lived cached instance. Functionally the same failure as get_adapter_class — unknown name after entry-point discovery — just surfaced on the instance-returning API used by mining code.

Source

Thrown at mempalace/backends/chroma.py:2440

    ) -> ChromaCollection:
        """Obtain a collection for a palace.

        Supports two calling conventions during the RFC 001 transition:

        * New (preferred): ``get_collection(palace=PalaceRef, collection_name=...,
          create=False, options=None)``.
        * Legacy: ``get_collection(palace_path, collection_name, create=False)``
          — still used by callers not yet migrated.
        """
        palace_ref, collection_name, create, options = _normalize_get_collection_args(args, kwargs)
        self.require_namespace_support(palace_ref)

        palace_path = palace_ref.local_path
        if palace_path is None:
            raise PalaceNotFoundError("ChromaBackend requires PalaceRef.local_path")

        if not create and not os.path.isdir(palace_path):
            raise PalaceNotFoundError(palace_path)

        if create:
            os.makedirs(palace_path, exist_ok=True)
            try:
                os.chmod(palace_path, 0o700)
            except (OSError, NotImplementedError):
                pass

        client = self._client(palace_path)

        ef = self._resolve_embedding_function()
        ef_kwargs = {"embedding_function": ef} if ef is not None else {}

        if create:
            try:
                collection = client.get_collection(collection_name, **ef_kwargs)
            except _ChromaNotFoundError:
                collection = client.create_collection(

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Validate against available_adapters() before calling; the message lists every registered name.
  2. Install the package that registers the missing adapter and retry (discovery runs on each call).
  3. Fix the adapter name in the configuration/source definition that produced it.

Example fix

from mempalace.sources.registry import available_adapters
adapters = available_adapters()
if name not in adapters:
    raise SystemExit(f'{name!r} not registered; have: {adapters}')
adapter = get_adapter(name)
Defensive patterns

Strategy: validation

Validate before calling

from mempalace.sources.registry import available_adapters
assert name in available_adapters(), f'{name!r} not registered; have {available_adapters()}'

Type guard

def adapter_available(name: str) -> bool:
    from mempalace.sources.registry import available_adapters
    return name in available_adapters()

Try / catch

try:
    adapter = get_adapter(name)
except KeyError:
    install_plugin_or_fallback(name)

Prevention

When it happens

Trigger: Calling get_adapter(name) where name is not registered: typo in source configuration, or a plugin adapter whose package is missing from the environment.

Common situations: Source configs naming adapters after a plugin uninstall; CI environments without the optional extras installed; names drifted between mempalace versions.

Related errors


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