MemPalace/mempalace · error · TypeError
unexpected arguments to get_collection
Error message
unexpected arguments to get_collection
What it means
A TypeError from get_collection's keyword-form argument parsing: after consuming palace=, collection_name=, create=, and options= from kwargs, there were leftover positional args or keyword arguments. The keyword form accepts exactly those four names and nothing else.
Source
Thrown at mempalace/backends/qdrant.py:1389
palace=palace,
collection_name=collection_name,
remote_collection=remote_collection,
)
with self._lock:
self._collections_by_palace.setdefault(palace.id, []).append(collection)
return collection
@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,View on GitHub (pinned to 06cb6987f0)
Solutions
- Pass only palace=, collection_name=, create=, options= in the keyword form
- Move the collection name into collection_name= instead of leaving it positional
- Check the backend's get_collection signature for supported option names
Example fix
# before backend.get_collection(palace=ref, "drawers", create=True) # after backend.get_collection(palace=ref, collection_name="drawers", create=True)
Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = {"palace", "collection_name", "create", "options"}
assert set(kwargs) <= ALLOWED and not args, f"bad get_collection kwargs: {set(kwargs) - ALLOWED}" Try / catch
try:
backend.get_collection(**kwargs)
except TypeError as e:
if "unexpected arguments" in str(e):
fix_kwargs(kwargs) # strip unsupported keys, log them
raise Prevention
- Wrap get_collection in a typed helper with an explicit signature
- Keep call sites keyword-only and limited to the four supported names
When it happens
Trigger: get_collection(palace=ref, "drawers") (mixing a positional arg with the palace= keyword), or adding unknown kwargs like palace=ref, collection_name="x", timeout=30 / embedder=... .
Common situations: Copy-pasting call signatures from another backend with extra options; refactoring old positional calls by partially converting to keywords; IDE autocompleting a parameter that does not exist.
Related errors
- palace= must be a PalaceRef instance
- collection_name is required
- get_collection requires palace= or a positional palace_path
- qdrant requires explicit embeddings
- add ids must be unique
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/b782c46d84ba8817.
Report an issue: GitHub.