{"record":{"id":"33cb6a1dfcdd20bc","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"memory-prompt-id-or-a-target-condition-is-required","errorCode":null,"errorMessage":"memory_prompt_id or a target condition is required","messagePattern":"memory_prompt_id or a target condition is required","errorType":"validation","errorClass":"ParamError","httpStatus":null,"severity":"error","filePath":"sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py","lineNumber":128,"sourceCode":"        team, agent = team_id or self._team_id, agent_id or self._agent_id\n        if agent and not team:\n            raise ParamError(\"team_id is required with agent_id\")\n        return self._get(f\"{_ROOT}/setting/list\", _strip_none({\n            \"memory_prompt_id\": memory_prompt_id, \"target_type\": target_type,\n            \"team_id\": team, \"agent_id\": agent, \"layer\": layer,\n            \"limit\": limit, \"offset\": offset, \"time_order\": time_order,\n        }))\n\n    def list_setting_logs(self, *, memory_prompt_id: Optional[str] = None,\n                          start_time: Optional[str] = None, end_time: Optional[str] = None,\n                          team_id: Optional[str] = None, agent_id: Optional[str] = None,\n                          action: Optional[str] = None, limit: Optional[int] = None,\n                          offset: Optional[int] = None, time_order: Optional[str] = None) -> Dict[str, Any]:\n        team, agent = team_id or self._team_id, agent_id or self._agent_id\n        if agent and not team:\n            raise ParamError(\"team_id is required with agent_id\")\n        if not memory_prompt_id and not team and not agent:\n            raise ParamError(\"memory_prompt_id or a target condition is required\")\n        return self._get(f\"{_ROOT}/log\", _strip_none({\n            \"memory_prompt_id\": memory_prompt_id, \"start_time\": start_time, \"end_time\": end_time,\n            \"team_id\": team, \"agent_id\": agent, \"action\": action, \"limit\": limit,\n            \"offset\": offset, \"time_order\": time_order,\n        }))\n\n    def close(self) -> None:\n        self._stub.close()\n\n\nclass AsyncMemoryPromptClient:\n    \"\"\"Asynchronous variant of :class:`MemoryPromptClient`.\"\"\"\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":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py#L110-L146","documentation":"list_setting_logs requires at least one query anchor: memory_prompt_id, team_id, or agent_id. When all three resolve to nothing (no arguments and no instance defaults), the request would be unbounded, so the client raises ParamError to force a scoped query.","triggerScenarios":"Calling list_setting_logs() with no arguments on a client constructed without team_id/agent_id, optionally with only time/action/limit filters supplied.","commonSituations":"Developers expect a plain 'list all logs' API like other systems; defaults for team_id were removed from the constructor call; pagination-only calls (limit/offset/time_order) that forgot any entity scope.","solutions":["Pass a scope: list_setting_logs(team_id=\"my-team\") or list_setting_logs(memory_prompt_id=\"pid\").","Construct the client with a default team_id so every log query is automatically scoped.","Combine filters as needed, e.g. memory_prompt_id plus start_time/end_time for a targeted audit."],"exampleFix":"# before\nclient.list_setting_logs(limit=50)  # raises\n\n# after\nclient.list_setting_logs(team_id=\"my-team\", limit=50)","handlingStrategy":"validation","validationCode":"if not (memory_prompt_id or team_id or agent_id):\n    raise ValueError(\"list_setting_logs requires memory_prompt_id or team_id/agent_id\")\nclient.list_setting_logs(memory_prompt_id=memory_prompt_id, team_id=team_id)","typeGuard":"def is_scoped_log_query(args: dict) -> bool:\n    return bool(args.get(\"memory_prompt_id\") or args.get(\"team_id\") or args.get(\"agent_id\"))","tryCatchPattern":"try:\n    logs = client.list_setting_logs(limit=50)\nexcept ParamError as e:\n    logging.error(\"Unbounded log query rejected: %s\", e)\n    logs = client.list_setting_logs(team_id=default_team, limit=50)","preventionTips":["Never issue log queries without at least one scoping entity.","Default the client's team_id at construction so queries are always bounded.","Review pagination-only calls during code review for missing scope."],"tags":["python","parameter-validation","unbounded-query","required-parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}