mem0ai/mem0 · error · ValueError

At least one parameter must be provided for update: custom_i

Error message

At least one parameter must be provided for update: custom_instructions, custom_categories, multilingual, decay, agent_custom_instructions

What it means

The sync project update() refuses no-op calls: if every one of custom_instructions, custom_categories, multilingual, decay, and agent_custom_instructions is None, it raises ValueError instead of sending an empty PATCH. This prevents meaningless API round-trips and accidental clears. The async twin raises identically at project.py:756.

Source

Thrown at mem0/client/project.py:432

        Returns:
            Dictionary containing the API response.

        Raises:
            ValidationError: If the input data is invalid.
            AuthenticationError: If authentication fails.
            RateLimitError: If rate limits are exceeded.
            NetworkError: If network connectivity issues occur.
            ValueError: If org_id or project_id are not set.
        """
        if (
            custom_instructions is None
            and custom_categories is None
            and multilingual is None
            and decay is None
            and agent_custom_instructions is None
        ):
            raise ValueError(
                "At least one parameter must be provided for update: "
                "custom_instructions, custom_categories, multilingual, decay, "
                "agent_custom_instructions"
            )

        payload = self._prepare_params(
            {
                "custom_instructions": custom_instructions,
                "custom_categories": custom_categories,
                "multilingual": multilingual,
                "decay": decay,
                "agent_custom_instructions": agent_custom_instructions,
            }
        )
        response = self._client.patch(
            f"/api/v1/orgs/organizations/{self.config.org_id}/projects/{self.config.project_id}/",
            json=payload,
        )

View on GitHub (pinned to 001c235229)

Solutions

  1. Pass at least one of the five parameters you actually intend to change
  2. Skip the update call entirely when your change-set is empty (guard in caller code)
  3. Log the intended changes before calling to catch empty payloads early

Example fix

# before
updates = {k: v for k, v in form_data.items() if k in FIELDS}
client.project.update(**updates)  # ValueError when nothing changed

# after
updates = {k: v for k, v in form_data.items() if k in FIELDS and v is not None}
if updates:
    client.project.update(**updates)
Defensive patterns

Strategy: validation

Validate before calling

FIELDS = ("custom_instructions", "custom_categories", "multilingual", "decay", "agent_custom_instructions")
updates = {k: v for k, v in changes.items() if k in FIELDS and v is not None}
if not updates:
    logger.info("no project settings changed; skipping update")
else:
    client.project.update(**updates)

Type guard

def has_update_payload(d: dict) -> bool:
    FIELDS = {"custom_instructions", "custom_categories", "multilingual", "decay", "agent_custom_instructions"}
    return any(v is not None for k, v in d.items() if k in FIELDS)

Try / catch

try:
    client.project.update(**updates)
except ValueError as e:
    if "At least one parameter" in str(e):
        return  # deliberate no-op
    raise

Prevention

When it happens

Trigger: Calling `client.project.update()` with no arguments, or with all five parameters left as None (e.g. a settings dict where every key mapped to None).

Common situations: Building a PATCH-style caller that forwards an options dict where all values default to None; UI 'save' button pressed without any changed field; conditionally building kwargs that end up empty.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/924e795de52c434f. Report an issue: GitHub.