infiniflow/ragflow · warning · ArgumentException
101
101
Error message
Memory type must be a list.
What it means
Validation in create_memory: the 'memory_type' field must be a JSON array (Python list); passing a bare string, number, dict, or null raises ArgumentException before the type-value check runs. Valid elements are lowercased MemoryType enum names checked separately.
Source
Thrown at api/apps/services/memory_api_service.py:98
:param memory_info: {
"name": str,
"memory_type": list[str],
"embd_id": str,
"llm_id": str,
"tenant_embd_id": str | None,
"tenant_llm_id": str | None
}
"""
# check name length
name = memory_info["name"]
memory_name = name.strip()
if len(memory_name) == 0:
raise ArgumentException("Memory name cannot be empty or whitespace.")
if len(memory_name) > MEMORY_NAME_LIMIT:
raise ArgumentException(f"Memory name '{memory_name}' exceeds limit of {MEMORY_NAME_LIMIT}.")
# check memory_type valid
if not isinstance(memory_info["memory_type"], list):
raise ArgumentException("Memory type must be a list.")
memory_type = set(memory_info["memory_type"])
invalid_type = memory_type - {e.name.lower() for e in MemoryType}
if invalid_type:
raise ArgumentException(f"Memory type '{invalid_type}' is not supported.")
memory_type = list(memory_type)
success, res = MemoryService.create_memory(
tenant_id=current_user.id,
name=memory_name,
memory_type=memory_type,
embd_id=memory_info["embd_id"],
llm_id=memory_info["llm_id"],
tenant_embd_id=memory_info.get("tenant_embd_id"),
tenant_llm_id=memory_info.get("tenant_llm_id"),
)
if success:
return True, format_ret_data_from_memory(res)
else:
return False, resView on GitHub (pinned to 554fb1133a)
Solutions
- Always send memory_type as an array, wrapping single values: ["longterm"]
- Fix the client DTO/type so memory_type: string[] not string
- Validate with Array.isArray(value) in JS / isinstance(x, list) in Python before the call
Example fix
# before
{"memory_type": "LongTerm"}
# after
{"memory_type": ["LongTerm"]} Defensive patterns
Strategy: type-guard
Validate before calling
if not isinstance(payload.get("memory_type"), list):
payload["memory_type"] = [payload["memory_type"]] if payload.get("memory_type") else [] Type guard
def is_memory_type_list(v) -> bool:
return isinstance(v, list) Prevention
- Type the field as string[] in client schemas/DTOs
- Always wrap single values in an array
- Remember create rejects both non-list and unknown element values — fix shape first
When it happens
Trigger: POST create-memory with memory_type="" or memory_type="LongTerm" (a plain string instead of ["LongTerm"]), memory_type=null, or a dict like {"type": ...}.
Common situations: Clients sending a single type as a scalar because they only need one; JSON schemas that mark the field optional-string; copy-pasting examples from older API versions where the field was a string.
Related errors
- ARGUMENT_ERROR
- SANDBOX_LOCAL_MAX_MEMORY_MB must be greater than 0.
- main() must be defined or exported.
- main() must return a value. Use null for an empty result.
- main() returned a non-JSON-serializable value.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/f8b1a6c33756d077.
Report an issue: GitHub.