{"record":{"id":"bc4d71632986e4cb","repo":"TencentCloud/TencentDB-Agent-Memory","slug":"team-id-is-required-with-agent-id","errorCode":null,"errorMessage":"team_id is required with agent_id","messagePattern":"team_id is required with agent_id","errorType":"validation","errorClass":"ParamError","httpStatus":null,"severity":"error","filePath":"sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py","lineNumber":112,"sourceCode":"            \"team_id\": team, \"agent_ids\": agent_ids, \"layer\": layer,\n        }))\n\n    def clear(self, *, layer: str, team_id: Optional[str] = None,\n              agent_ids: Optional[List[str]] = None) -> Dict[str, Any]:\n        team = team_id or self._team_id\n        _target(team, agent_ids)\n        return self._stub.post(f\"{_ROOT}/set\", _strip_none({\n            \"action\": \"clear\", \"team_id\": team, \"agent_ids\": agent_ids, \"layer\": layer,\n        }))\n\n    def list_settings(self, *, memory_prompt_id: Optional[str] = None,\n                      target_type: Optional[str] = None, team_id: Optional[str] = None,\n                      agent_id: Optional[str] = None, layer: Optional[str] = None,\n                      limit: Optional[int] = None, offset: Optional[int] = None,\n                      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        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,","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/TencentCloud/TencentDB-Agent-Memory/blob/3efcd317b84146d6a08518ac0f7ee7c8a8d200ec/sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py#L94-L130","documentation":"list_settings allows filtering by team, by team+agent, or by prompt id, but an agent_id alone is not a valid scope: agents belong to teams, so the API requires team_id whenever agent_id is set. The client checks this (after resolving instance defaults) and raises ParamError for the agent-without-team combination.","triggerScenarios":"Calling list_settings(agent_id=\"a1\") (or constructing the client with only agent_id and calling list_settings()) without any team_id argument.","commonSituations":"Developer knows the agent but not its parent team; instance-level agent_id default was set at construction while team_id was omitted; agent IDs copied from another environment where the team mapping changed.","solutions":["Add team_id to the call: list_settings(agent_id=\"a1\", team_id=\"my-team\").","Provide team_id alone if you want all settings for the team.","Construct the client with a default team_id so it pairs with the agent_id default."],"exampleFix":"# before\nclient.list_settings(agent_id=\"agent-1\")  # raises\n\n# after\nclient.list_settings(agent_id=\"agent-1\", team_id=\"my-team\")","handlingStrategy":"validation","validationCode":"if agent_id and not (team_id or client._team_id):\n    raise ValueError(\"team_id must accompany agent_id\")\nclient.list_settings(memory_prompt_id=pid, team_id=team_id, agent_id=agent_id)","typeGuard":"def valid_target(team_id: object, agent_id: object) -> bool:\n    return not (agent_id and not team_id)","tryCatchPattern":"try:\n    settings = client.list_settings(agent_id=agent_id, team_id=team_id)\nexcept ParamError as e:\n    logging.error(\"Invalid target scope for list_settings: %s\", e)\n    settings = []","preventionTips":["Treat (team_id, agent_id) as an atomic pair in all list/filter calls.","Resolve the team from your agent registry before calling list_settings.","Set team_id as an instance default on the client."],"tags":["python","parameter-validation","dependent-parameter","team-id"],"backgroundTag":"missing-required-argument","analyzedSha":"3efcd317b84146d6a08518ac0f7ee7c8a8d200ec","analyzedAt":"2026-09-01T05:44:22.276Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}