TencentCloud/TencentDB-Agent-Memory · error · ParamError
v3 MemoryClient requires non-empty {', '.join(missing)} at c
Error message
v3 MemoryClient requires non-empty {', '.join(missing)} at construction time What it means
v3 MemoryClient requires team_id, agent_id, and user_id — the isolation triple — to be non-empty at construction time. Rather than failing later with a server 422, _validate_construction raises ParamError immediately listing every missing field.
Source
Thrown at sdk/memory-core/python/tencentdb_agent_memory/v3/client.py:94
if len(deduped) > max_items:
raise ParamError(f"{field} accepts at most {max_items} items, got {len(deduped)}")
return deduped
def _validate_construction(team_id: str, agent_id: str, user_id: str) -> None:
"""v3 构造时 team+agent+user 必填,任一缺失立刻 ParamError,避免 422 才暴露。
session_id 不在构造时强校验(L2/L3 接口不需要);L0/L1 方法调用时再单独校验。
"""
missing = [
name for name, val in (
("team_id", team_id),
("agent_id", agent_id),
("user_id", user_id),
) if not val
]
if missing:
raise ParamError(
f"v3 MemoryClient requires non-empty {', '.join(missing)} at construction time"
)
class _IsolationCtx:
"""Carrier for the v3 isolation context. Internal only; exposed via with_isolation()."""
__slots__ = ("team_id", "agent_id", "user_id", "session_id", "task_id")
def __init__(
self,
team_id: str,
agent_id: str,
user_id: str,
session_id: Optional[str] = None,
task_id: Optional[str] = None,
) -> None:
self.team_id = team_idView on GitHub (pinned to 3efcd317b8)
Solutions
- Pass non-empty team_id, agent_id, and user_id to the constructor
- Verify the env/config values actually populate (e.g. os.environ['TEAM_ID'] not '')
- For isolated sub-clients use with_isolation() supplying all three values
- Print the config object before constructing to confirm no blank fields
Example fix
// before
client = MemoryClient(endpoint=ep, api_key=key, service_id=sid, team_id=os.getenv("TEAM_ID"))
# after
team_id = os.environ["TEAM_ID"] # fail fast if unset
agent_id = os.environ["AGENT_ID"]
user_id = os.environ["USER_ID"]
client = MemoryClient(endpoint=ep, api_key=key, service_id=sid,
team_id=team_id, agent_id=agent_id, user_id=user_id) Defensive patterns
Strategy: validation
Validate before calling
def build_client(cfg):
missing = [k for k in ("team_id", "agent_id", "user_id") if not cfg.get(k)]
if missing:
raise ValueError(f"missing config: {missing}")
return MemoryClient(..., **{k: cfg[k] for k in ("team_id", "agent_id", "user_id")}) Try / catch
try:
client = MemoryClient(...)
except ParamError as e:
raise ConfigError(f"client construction failed: {e}") from e Prevention
- Fail fast at app startup if any of team_id/agent_id/user_id env vars are empty
- Centralize client construction in one factory with a config check
- Use required env lookups (os.environ[...]) instead of .get with defaults
- Document the isolation triple as mandatory for v3 in your onboarding docs
When it happens
Trigger: Instantiating MemoryClient or AsyncMemoryClient with empty-string or None team_id/agent_id/user_id, or with_isolation() with any of the triple omitted/blank. Only fields that are falsy are reported; all missing ones are named in the message.
Common situations: Config read from env vars where a var is unset/empty; copy-pasting a client snippet from another project without the team/agent ids; upgrading from an API version where these were optional; template rendering leaving placeholders empty.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- service_id must be provided
- llm.provider=proxy 且 useMemorySystemUserKey=false 时必须显式 llm.
- teamId is required for an agent prompt setting
- [skill-worker-pool] concurrency must be positive integer, go
- EmbeddingService: dimensions is required for remote provider
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/44b09e66a3e88767.
Report an issue: GitHub.