MemPalace/mempalace · error · TypeError

collection_name is required

Error message

collection_name is required

What it means

A TypeError from get_collection's positional form: the first positional arg was consumed as palace_path, but no collection name could be found — neither a second positional argument nor a collection_name= keyword.

Source

Thrown at mempalace/backends/qdrant.py:1396

    @staticmethod
    def _normalize_args(args, kwargs):
        if "palace" in kwargs:
            palace = kwargs.pop("palace")
            if not isinstance(palace, PalaceRef):
                raise TypeError("palace= must be a PalaceRef instance")
            collection_name = kwargs.pop("collection_name")
            create = bool(kwargs.pop("create", False))
            options = kwargs.pop("options", None)
            if args or kwargs:
                raise TypeError("unexpected arguments to get_collection")
            return palace, collection_name, create, options
        if args:
            palace_path = args[0]
            rest = list(args[1:])
            collection_name = kwargs.pop("collection_name", None) or (rest.pop(0) if rest else None)
            if collection_name is None:
                raise TypeError("collection_name is required")
            create = kwargs.pop("create", False)
            if rest:
                create = rest.pop(0)
            options = kwargs.pop("options", None)
            if rest or kwargs:
                raise TypeError("unexpected arguments to get_collection")
            return (
                PalaceRef(id=palace_path, local_path=palace_path),
                collection_name,
                bool(create),
                options,
            )
        if "palace_path" in kwargs:
            palace_path = kwargs.pop("palace_path")
            collection_name = kwargs.pop("collection_name")
            create = bool(kwargs.pop("create", False))
            options = kwargs.pop("options", None)
            if kwargs:

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Supply the collection name: get_collection("/palace", "drawers") or collection_name="drawers"
  2. If passing create positionally, it must come after the name: get_collection(path, name, True)
  3. Check kwargs spelling (collection_name, not name/collection)

Example fix

# before
backend.get_collection("/data/palace", create=True)
# after
backend.get_collection("/data/palace", "drawers", create=True)
Defensive patterns

Strategy: validation

Validate before calling

def open_collection(backend, palace_path: str, name: str, create: bool = False):
    assert name, "collection_name is required"
    return backend.get_collection(palace_path, name, create)

Prevention

When it happens

Trigger: get_collection("/palace") or get_collection("/palace", create=True) — the second positional was meant as the name but is missing, or create=True was passed positionally where the name should be, leaving collection_name None.

Common situations: Refactoring a call and dropping the name argument; passing create as the second positional while forgetting the name; typo like collection_nm= in kwargs so pop('collection_name') misses.

Related errors


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