TencentCloud/TencentDB-Agent-Memory · error · ParamError

delete_atomic requires a non-empty ids list

Error message

delete_atomic requires a non-empty ids list

What it means

delete_atomic posts to /v3/atomic/delete which deletes by explicit ids; the ids list is mandatory and must contain at least one valid item after normalization/dedup. An empty list (or one whose elements were all invalid) raises ParamError rather than issuing a no-op request.

Source

Thrown at sdk/memory-core/python/tencentdb_agent_memory/v3/client.py:430

                "session_id": self._iso.resolve_session(session_id),
                "query": query,
                "limit": limit,
                "type": type,
                "time_start": time_start,
                "time_end": time_end,
            }),
        )

    def delete_atomic(
        self,
        ids: List[str],
        *,
        session_id: Optional[str] = None,
    ) -> Dict[str, Any]:
        """``POST /v3/atomic/delete`` — ids必填,单次至多 5000 条。"""
        normalized = _normalize_delete_ids("ids", ids, 5000)
        if not normalized:
            raise ParamError("delete_atomic requires a non-empty ids list")
        return self._stub.post(
            f"{_V3}/atomic/delete",
            _strip_none({
                **self._iso.base_body(),
                "session_id": self._iso.resolve_session(session_id),
                "ids": normalized,
            }),
        )

    def count_atomic(
        self,
        *,
        type: Optional[str] = None,
        time_start: Optional[str] = None,
        time_end: Optional[str] = None,
        session_id: Optional[str] = None,
    ) -> Dict[str, Any]:
        """``POST /v3/atomic/count`` — 与 query 同过滤器,仅返回 ``{total}``."""

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Ensure at least one non-empty id: delete_atomic(ids=["mem-123"])
  2. Guard before calling: if ids: client.delete_atomic(ids=ids)
  3. If nothing to delete, skip the call entirely instead of sending an empty batch
  4. If elements were filtered out upstream, fix the filter so valid ids survive

Example fix

// before
client.delete_atomic(ids=stale_ids)  # stale_ids may be []
// after
if stale_ids:
    client.delete_atomic(ids=stale_ids)
Defensive patterns

Strategy: validation

Validate before calling

def delete_atomic_safe(client, ids):
    clean = [i for i in ids if isinstance(i, str) and i.strip()]
    return client.delete_atomic(ids=clean) if clean else None

Type guard

def nonempty_str_list(v) -> bool:
    return isinstance(v, (list, tuple)) and len(v) > 0 and all(isinstance(i, str) and i.strip() for i in v)

Try / catch

try:
    client.delete_atomic(ids=ids)
except ParamError as e:
    if "non-empty ids list" in str(e):
        logger.info("nothing to delete, skipping atomic delete")

Prevention

When it happens

Trigger: delete_atomic(ids=[]) ; delete_atomic(ids=['', ' ']) where every element fails stripping; passing an id list variable that ended up empty after filtering.

Common situations: Conditional scripts where the id-collection step produced nothing; forwarding a possibly-empty list from upstream config; forgetting that normalization strips/dedups before the emptiness check.

Related errors


AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/59ba717084b3c7fa. Report an issue: GitHub.