TencentCloud/TencentDB-Agent-Memory · error · ParamError
{name} must be a non-empty string
Error message
{name} must be a non-empty string What it means
_required in memory_prompt.py is the same fail-fast string validator used by MemoryPromptClient.get and get_by_memory_id. Any id argument that is not a non-empty, non-whitespace string raises a ParamError naming the parameter before an HTTP call happens.
Source
Thrown at sdk/memory-core/python/tencentdb_agent_memory/v3/memory_prompt.py:19
"""Clients for ``/v3/memory-prompt/*`` management APIs."""
from __future__ import annotations
from typing import Any, Dict, Iterable, List, Optional
from .._http import Stub
from .._v3_http import AsyncHttpStub, HttpStub
from ..errors import ParamError
_ROOT = "/v3/memory-prompt"
def _strip_none(value: Dict[str, Any]) -> Dict[str, Any]:
return {key: item for key, item in value.items() if item is not None}
def _required(name: str, value: str) -> str:
if not isinstance(value, str) or not value.strip():
raise ParamError(f"{name} must be a non-empty string")
return value
def _ids(values: Iterable[str], name: str) -> List[str]:
result = list(dict.fromkeys(values))
if not result or any(not isinstance(item, str) or not item.strip() for item in result):
raise ParamError(f"{name} must be a non-empty list of non-empty strings")
return result
def _target(team_id: Optional[str], agent_ids: Optional[List[str]]) -> None:
if agent_ids is not None:
_ids(agent_ids, "agent_ids")
if not team_id:
raise ParamError("team_id is required with agent_ids")
class MemoryPromptClient:View on GitHub (pinned to 3efcd317b8)
Solutions
- Validate the id is a non-empty string before the call
- Fix the upstream step that produced the empty id
- Use the listing APIs to obtain a valid id instead of guessing one
Example fix
// before
prompt = client.get_by_memory_id(memory_id)
// after
if not (isinstance(memory_id, str) and memory_id.strip()):
raise ValueError('memory_id is required')
prompt = client.get_by_memory_id(memory_id) Defensive patterns
Strategy: validation
Validate before calling
if not (isinstance(prompt_id, str) and prompt_id.strip()):
raise ValueError('prompt_id must be a non-empty string') Type guard
def is_nonempty_str(v: object) -> bool:
return isinstance(v, str) and bool(v.strip()) Try / catch
try:
prompt = prompt_client.get(prompt_id)
except ParamError as e:
logger.warning('invalid prompt id: %s', e) Prevention
- Check ids exist before chained lookups
- Use .strip() normalization on ids from external sources
- Type-hint id params as str (not Optional[str]) when required
When it happens
Trigger: prompt_client.get(prompt_id='') or get_by_memory_id(memory_id=None) — e.g. an id variable that was never assigned, a whitespace-padded placeholder, or a non-string type.
Common situations: Chained lookups where an earlier step returned an empty id; deserialized JSON with missing keys defaulting to ''; passing None when a record was expected to exist.
Related errors
- {name} must be a non-empty string
- {name} must be a non-empty list of non-empty strings
- team_id is required with agent_ids
- service_id must be provided
- team_id is required for effective prompt lookup
AI-assisted analysis of TencentCloud/TencentDB-Agent-Memory@3efcd317b8 (2026-09-01).
Data as JSON: /api/errors/81477a19fb44319d.
Report an issue: GitHub.