{"record":{"id":"b20af8efb96a38e9","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"name-must-be-a-non-empty-list-of-non-empty-strin","errorCode":null,"errorMessage":"{name} must be a non-empty list of non-empty strings","messagePattern":"(.+?) must be a non-empty list of non-empty strings","errorType":"validation","errorClass":"ParamError","httpStatus":null,"severity":"error","filePath":"sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py","lineNumber":26,"sourceCode":"from ..errors import ParamError\n\n_ROOT = \"/v3/memory-prompt\"\n\n\ndef _strip_none(value: Dict[str, Any]) -> Dict[str, Any]:\n    return {key: item for key, item in value.items() if item is not None}\n\n\ndef _required(name: str, value: str) -> str:\n    if not isinstance(value, str) or not value.strip():\n        raise ParamError(f\"{name} must be a non-empty string\")\n    return value\n\n\ndef _ids(values: Iterable[str], name: str) -> List[str]:\n    result = list(dict.fromkeys(values))\n    if not result or any(not isinstance(item, str) or not item.strip() for item in result):\n        raise ParamError(f\"{name} must be a non-empty list of non-empty strings\")\n    return result\n\n\ndef _target(team_id: Optional[str], agent_ids: Optional[List[str]]) -> None:\n    if agent_ids is not None:\n        _ids(agent_ids, \"agent_ids\")\n        if not team_id:\n            raise ParamError(\"team_id is required with agent_ids\")\n\n\nclass MemoryPromptClient:\n    \"\"\"Synchronous Prompt CRUD, target binding, resolution and setting-log client.\"\"\"\n\n    def __init__(self, endpoint: str = \"\", api_key: str = \"\", service_id: Optional[str] = None,\n                 *, team_id: Optional[str] = None, agent_id: Optional[str] = None,\n                 timeout: float = 30, verify: bool = True, stub: Optional[Stub] = None) -> None:\n        if stub is not None:\n            self._stub = stub","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py#L8-L44","documentation":"_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.","triggerScenarios":"delete(ids=[]) or delete(ids=['', ' ']); _target(team_id=..., agent_ids=[]) with an empty agent list; passing non-string elements (ints, None) in the list.","commonSituations":"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.","solutions":["Ensure the list has at least one non-empty string before calling","Convert non-string ids to str() and filter blanks first","Skip the call entirely when the list is empty"],"exampleFix":"// before\nclient.delete(agent_ids_raw)\n// after\nids = [str(a).strip() for a in agent_ids_raw if str(a).strip()]\nif ids:\n    client.delete(ids)","handlingStrategy":"validation","validationCode":"ids = [i for i in raw_ids if isinstance(i, str) and i.strip()]\nif not ids:\n    return","typeGuard":"def is_valid_id_list(v: object) -> bool:\n    return isinstance(v, list) and len(v) > 0 and all(isinstance(i, str) and i.strip() for i in v)","tryCatchPattern":"try:\n    prompt_client.delete(ids)\nexcept ParamError as e:\n    logger.warning('delete skipped: %s', e)","preventionTips":["Sanitize and de-duplicate id lists before API calls","Skip empty batches explicitly","Keep list element types homogeneous (str only)"],"tags":["python","parameter-validation","list-validation"],"backgroundTag":"empty-required-parameter","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}