jd-opensource/joyagent-jdgenie · error · ValueError
❌ 必须提供 ids 或 filters 中至少一个参数
Error message
❌ 必须提供 ids 或 filters 中至少一个参数
What it means
QdrantUtils.delete raises ValueError when neither ids nor filters is provided, because Qdrant's delete API requires a point selector — either explicit point IDs or a filter. The guard prevents an ambiguous/empty delete request.
Solutions
- Pass point ids: delete(ids=42) or delete(ids=[1,2,3])
- Pass a filter dict matching your search() filters syntax, e.g. delete(filters={"must": [{"key": "status", "match": {"value": "old"}}]})
- Guard the call site: raise/log before calling delete if both selectors are empty instead of hitting the API
- If the intent is to clear a collection, use a dedicated delete-collection API rather than delete() with no selector
Example fix
// before
qdrant.delete() # ValueError
// after
qdrant.delete(ids=[101, 102])
# or
qdrant.delete(filters={"key": "tenant", "match": {"value": "test"}}) Defensive patterns
Strategy: validation
Validate before calling
def safe_delete(qdrant, ids=None, filters=None):
if ids is None and filters is None:
raise ValueError('delete requires ids or filters')
return qdrant.delete(ids=ids, filters=filters) Type guard
def has_delete_selector(ids, filters):
return ids is not None or filters is not None Try / catch
try:
qdrant.delete(ids=ids, filters=filters)
except ValueError as e:
logger.error('refusing empty delete: %s', e) # no points deleted Prevention
- Never call delete() without at least one selector
- Assert selector presence in wrapper utilities
- For full wipes use collection-level delete APIs
- Dry-run the filter against search() first to confirm what would be deleted
When it happens
Trigger: Calling client_wrapper.delete() with ids=None and filters=None, e.g. delete() with no args, or both parameters defaulting after a failed variable assignment.
Common situations: Building delete calls dynamically where the id/filter variables end up unset; copy-pasted calls dropping arguments; scripting bulk cleanup where the condition list came back empty.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/f1123a79a93e0b1b.
Report an issue: GitHub.
Appendix: source
Thrown at genie-tool/genie_tool/util/qdrant_utils.py:168
# 如果已经是 PointStruct 列表,则直接使用
return self.client.upsert(
collection_name=self.collection_name,
points=points
)
def delete(self, ids=None, filters=None):
"""
删除向量点,支持两种方式:
1. 指定 id 列表删除
2. 使用过滤条件删除(推荐用于复杂场景)
:param ids: int 或 List[int],要删除的点 ID
:param filters: dict,过滤条件,格式同 search() 中的 filters
:return: 删除操作响应
"""
if ids is None and filters is None:
raise ValueError("❌ 必须提供 ids 或 filters 中至少一个参数")
if ids is not None:
if isinstance(ids, int):
ids = [ids]
delete_request = self.client.delete(
collection_name=self.collection_name,
points=ids # 👈 旧版支持
)
else:
# 构建 filter 对象
must_conditions = []
for key, val in filters.items():
if isinstance(val, (str, bool, int, float)):
must_conditions.append(
FieldCondition(key=key, match=MatchValue(value=val))
)
elif isinstance(val, list):
must_conditions.append(View on GitHub (pinned to 2417e0b8b6)