MemPalace/mempalace · error · TypeError
get_collection requires palace= or a positional palace_path
Error message
get_collection requires palace= or a positional palace_path
What it means
A TypeError raised when get_collection is called with neither palace= (PalaceRef keyword) nor a positional first argument to use as palace_path. Every calling convention requires identifying the palace first.
Source
Thrown at mempalace/backends/qdrant.py:1422
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:
raise TypeError("unexpected arguments to get_collection")
return (
PalaceRef(id=palace_path, local_path=palace_path),
collection_name,
create,
options,
)
raise TypeError("get_collection requires palace= or a positional palace_path")
def close_palace(self, palace: PalaceRef | str) -> None:
palace_id = palace.id if isinstance(palace, PalaceRef) else palace
with self._lock:
collections = self._collections_by_palace.pop(palace_id, [])
for collection in collections:
collection.close()
def close(self) -> None:
with self._lock:
collections = [
collection
for palace_collections in self._collections_by_palace.values()
for collection in palace_collections
]
self._collections_by_palace.clear()
self._clients.clear()
self._closed = TrueView on GitHub (pinned to 06cb6987f0)
Solutions
- Pass the palace: get_collection(palace_ref, "drawers") or palace=ref / palace_path=... forms
- If wrapping get_collection, thread the palace argument through your wrapper
Example fix
# before backend.get_collection(collection_name="drawers", create=True) # after backend.get_collection(palace=ref, collection_name="drawers", create=True)
Defensive patterns
Strategy: validation
Validate before calling
def open_collection(backend, palace, name: str, create: bool = False):
if palace is None:
raise ValueError("palace is required")
return backend.get_collection(palace, name, create) Prevention
- Make palace a required first parameter of wrappers
- Static-type the wrapper so a missing palace fails at lint time
When it happens
Trigger: get_collection(collection_name="drawers", create=True) — only keyword collection options given, no palace in args or kwargs.
Common situations: Assuming the backend remembers the palace from a previous call; refactoring away the palace argument while building the request; defaulting arguments in a wrapper that accidentally drops the palace.
Related errors
- collection_name is required
- palace= must be a PalaceRef instance
- unexpected arguments to get_collection
- qdrant requires explicit embeddings
- add ids must be unique
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/64b0ec472e073669.
Report an issue: GitHub.