MemPalace/mempalace · error · ValueError

Embedding model mismatch reading palace at {palace_path!r}.

Error message

Embedding model mismatch reading palace at {palace_path!r}.
  Underlying ChromaDB error: {msg}
  Current MEMPALACE_EMBEDDING_MODEL={current_model!r}.
  The palace was built with a different embedding model. Either:
    (a) revert the model: unset MEMPALACE_EMBEDDING_MODEL (or set the previous value), or
    (b) re-embed in place: `{rebuild_cmd}` (writes new vectors with the current model).

What it means

A KeyError (with message) from get_transformation: the requested transformation name is neither one of the RESERVED_TRANSFORMATIONS nor resolvable here. The docstring notes that adapter-namespaced references (<adapter>_<transform>) should be resolved by getattr on the transforms module first — this helper only covers reserved names, so passing an adapter-prefixed name to it is a misuse, not a missing feature.

Source

Thrown at mempalace/backends/chroma.py:2466

        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(
                    collection_name,
                    metadata=_hnsw_creation_metadata(options),
                    **ef_kwargs,
                )
            except ValueError as e:
                explanation = self._explain_ef_mismatch(e, palace_path)
                if explanation:
                    raise ValueError(explanation) from e
                raise
        else:
            try:
                collection = client.get_collection(collection_name, **ef_kwargs)
            except _ChromaNotFoundError as e:
                raise CollectionNotInitializedError(palace_path) from e
            except ValueError as e:
                explanation = self._explain_ef_mismatch(e, palace_path)
                if explanation:
                    raise ValueError(explanation) from e
                raise
        _pin_hnsw_threads(collection)
        return ChromaCollection(collection, palace_path=palace_path)

    def close_palace(self, palace) -> None:
        """Drop cached handles for ``palace`` and release its SQLite file lock.

        Accepts ``PalaceRef`` or legacy path str. chromadb's rust-side file

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Check sorted(RESERVED_TRANSFORMATIONS) (listed in the message) and use an exact reserved name.
  2. For adapter-namespaced references, resolve via getattr on the transforms module / the adapter itself instead of this helper.
  3. Register the transformation under the adapter's namespace if you are authoring one.

Example fix

# before
get_transformation('convo_normalize')  # KeyError

# after
import mempalace.sources.transforms as T
fn = getattr(T, 'convo_normalize', None) or get_transformation('normalize')
Defensive patterns

Strategy: validation

Validate before calling

from mempalace.sources.transforms import RESERVED_TRANSFORMATIONS
if name not in RESERVED_TRANSFORMATIONS:
    import mempalace.sources.transforms as T
    if not hasattr(T, name):
        raise SystemExit(f'no transformation {name!r} (reserved: {sorted(RESERVED_TRANSFORMATIONS)})')

Type guard

def transformation_resolvable(name: str) -> bool:
    from mempalace.sources.transforms import RESERVED_TRANSFORMATIONS
    import mempalace.sources.transforms as T
    return name in RESERVED_TRANSFORMATIONS or hasattr(T, name)

Prevention

When it happens

Trigger: Calling get_transformation('strip') when 'strip' is not reserved; passing an adapter-namespaced reference like 'convo_normalize' to this helper instead of resolving it via getattr on the module.

Common situations: Code written before the reserved/adapter-namespaced split; typos in transformation names; expecting an adapter-provided transformation to be globally registered.

Related errors


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