TencentCloud/TencentDB-Agent-Memory · error · ParamError

memory_prompt_id or a target condition is required

Error message

memory_prompt_id or a target condition is required

What it means

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.

Source

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

        team, agent = team_id or self._team_id, agent_id or self._agent_id
        if agent and not team:
            raise ParamError("team_id is required with agent_id")
        return self._get(f"{_ROOT}/setting/list", _strip_none({
            "memory_prompt_id": memory_prompt_id, "target_type": target_type,
            "team_id": team, "agent_id": agent, "layer": layer,
            "limit": limit, "offset": offset, "time_order": time_order,
        }))

    def list_setting_logs(self, *, memory_prompt_id: Optional[str] = None,
                          start_time: Optional[str] = None, end_time: Optional[str] = None,
                          team_id: Optional[str] = None, agent_id: Optional[str] = None,
                          action: Optional[str] = None, limit: Optional[int] = None,
                          offset: Optional[int] = None, time_order: Optional[str] = None) -> Dict[str, Any]:
        team, agent = team_id or self._team_id, agent_id or self._agent_id
        if agent and not team:
            raise ParamError("team_id is required with agent_id")
        if not memory_prompt_id and not team and not agent:
            raise ParamError("memory_prompt_id or a target condition is required")
        return self._get(f"{_ROOT}/log", _strip_none({
            "memory_prompt_id": memory_prompt_id, "start_time": start_time, "end_time": end_time,
            "team_id": team, "agent_id": agent, "action": action, "limit": limit,
            "offset": offset, "time_order": time_order,
        }))

    def close(self) -> None:
        self._stub.close()


class AsyncMemoryPromptClient:
    """Asynchronous variant of :class:`MemoryPromptClient`."""

    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. Pass a scope: list_setting_logs(team_id="my-team") or list_setting_logs(memory_prompt_id="pid").
  2. Construct the client with a default team_id so every log query is automatically scoped.
  3. Combine filters as needed, e.g. memory_prompt_id plus start_time/end_time for a targeted audit.

Example fix

# before
client.list_setting_logs(limit=50)  # raises

# after
client.list_setting_logs(team_id="my-team", limit=50)
Defensive patterns

Strategy: validation

Validate before calling

if not (memory_prompt_id or team_id or agent_id):
    raise ValueError("list_setting_logs requires memory_prompt_id or team_id/agent_id")
client.list_setting_logs(memory_prompt_id=memory_prompt_id, team_id=team_id)

Type guard

def is_scoped_log_query(args: dict) -> bool:
    return bool(args.get("memory_prompt_id") or args.get("team_id") or args.get("agent_id"))

Try / catch

try:
    logs = client.list_setting_logs(limit=50)
except ParamError as e:
    logging.error("Unbounded log query rejected: %s", e)
    logs = client.list_setting_logs(team_id=default_team, limit=50)

Prevention

When it happens

Trigger: Calling list_setting_logs() with no arguments on a client constructed without team_id/agent_id, optionally with only time/action/limit filters supplied.

Common situations: 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.

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 TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01). Data as JSON: /api/errors/33cb6a1dfcdd20bc. Report an issue: GitHub.