TencentCloud/TencentDB-Agent-Memory · error · ParamError

{name} must be a non-empty list of non-empty strings

Error message

{name} must be a non-empty list of non-empty strings

What it means

_ids in memory_prompt.py validates list parameters (agent_ids via _target, and the ids argument of delete): the list must be non-empty and every entry a non-empty string, after de-duplication. Otherwise a ParamError naming the parameter is raised.

Source

Thrown at sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py:26

from ..errors import ParamError

_ROOT = "/v3/memory-prompt"


def _strip_none(value: Dict[str, Any]) -> Dict[str, Any]:
    return {key: item for key, item in value.items() if item is not None}


def _required(name: str, value: str) -> str:
    if not isinstance(value, str) or not value.strip():
        raise ParamError(f"{name} must be a non-empty string")
    return value


def _ids(values: Iterable[str], name: str) -> List[str]:
    result = list(dict.fromkeys(values))
    if not result or any(not isinstance(item, str) or not item.strip() for item in result):
        raise ParamError(f"{name} must be a non-empty list of non-empty strings")
    return result


def _target(team_id: Optional[str], agent_ids: Optional[List[str]]) -> None:
    if agent_ids is not None:
        _ids(agent_ids, "agent_ids")
        if not team_id:
            raise ParamError("team_id is required with agent_ids")


class MemoryPromptClient:
    """Synchronous Prompt CRUD, target binding, resolution and setting-log client."""

    def __init__(self, endpoint: str = "", api_key: str = "", service_id: Optional[str] = None,
                 *, team_id: Optional[str] = None, agent_id: Optional[str] = None,
                 timeout: float = 30, verify: bool = True, stub: Optional[Stub] = None) -> None:
        if stub is not None:
            self._stub = stub

View on GitHub (pinned to 3efcd317b8)

Solutions

  1. Ensure the list has at least one non-empty string before calling
  2. Convert non-string ids to str() and filter blanks first
  3. Skip the call entirely when the list is empty

Example fix

// before
client.delete(agent_ids_raw)
// after
ids = [str(a).strip() for a in agent_ids_raw if str(a).strip()]
if ids:
    client.delete(ids)
Defensive patterns

Strategy: validation

Validate before calling

ids = [i for i in raw_ids if isinstance(i, str) and i.strip()]
if not ids:
    return

Type guard

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

Try / catch

try:
    prompt_client.delete(ids)
except ParamError as e:
    logger.warning('delete skipped: %s', e)

Prevention

When it happens

Trigger: delete(ids=[]) or delete(ids=['', ' ']); _target(team_id=..., agent_ids=[]) with an empty agent list; passing non-string elements (ints, None) in the list.

Common situations: Batch delete where the selection ended up empty; agent ids collected from a filter that matched nothing; mixing typed id objects (UUID/int) with strings in the list.

Related errors


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