{"record":{"id":"924e795de52c434f","repo":"mem0ai/mem0","slug":"at-least-one-parameter-must-be-provided-for-update","errorCode":null,"errorMessage":"At least one parameter must be provided for update: custom_instructions, custom_categories, multilingual, decay, agent_custom_instructions","messagePattern":"At least one parameter must be provided for update: custom_instructions, custom_categories, multilingual, decay, agent_custom_instructions","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/client/project.py","lineNumber":432,"sourceCode":"\n        Returns:\n            Dictionary containing the API response.\n\n        Raises:\n            ValidationError: If the input data is invalid.\n            AuthenticationError: If authentication fails.\n            RateLimitError: If rate limits are exceeded.\n            NetworkError: If network connectivity issues occur.\n            ValueError: If org_id or project_id are not set.\n        \"\"\"\n        if (\n            custom_instructions is None\n            and custom_categories is None\n            and multilingual is None\n            and decay is None\n            and agent_custom_instructions is None\n        ):\n            raise ValueError(\n                \"At least one parameter must be provided for update: \"\n                \"custom_instructions, custom_categories, multilingual, decay, \"\n                \"agent_custom_instructions\"\n            )\n\n        payload = self._prepare_params(\n            {\n                \"custom_instructions\": custom_instructions,\n                \"custom_categories\": custom_categories,\n                \"multilingual\": multilingual,\n                \"decay\": decay,\n                \"agent_custom_instructions\": agent_custom_instructions,\n            }\n        )\n        response = self._client.patch(\n            f\"/api/v1/orgs/organizations/{self.config.org_id}/projects/{self.config.project_id}/\",\n            json=payload,\n        )","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/client/project.py#L414-L450","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Pass at least one of the five parameters you actually intend to change","Skip the update call entirely when your change-set is empty (guard in caller code)","Log the intended changes before calling to catch empty payloads early"],"exampleFix":"# before\nupdates = {k: v for k, v in form_data.items() if k in FIELDS}\nclient.project.update(**updates)  # ValueError when nothing changed\n\n# after\nupdates = {k: v for k, v in form_data.items() if k in FIELDS and v is not None}\nif updates:\n    client.project.update(**updates)","handlingStrategy":"validation","validationCode":"FIELDS = (\"custom_instructions\", \"custom_categories\", \"multilingual\", \"decay\", \"agent_custom_instructions\")\nupdates = {k: v for k, v in changes.items() if k in FIELDS and v is not None}\nif not updates:\n    logger.info(\"no project settings changed; skipping update\")\nelse:\n    client.project.update(**updates)","typeGuard":"def has_update_payload(d: dict) -> bool:\n    FIELDS = {\"custom_instructions\", \"custom_categories\", \"multilingual\", \"decay\", \"agent_custom_instructions\"}\n    return any(v is not None for k, v in d.items() if k in FIELDS)","tryCatchPattern":"try:\n    client.project.update(**updates)\nexcept ValueError as e:\n    if \"At least one parameter\" in str(e):\n        return  # deliberate no-op\n    raise","preventionTips":["Filter None values out of change-sets and short-circuit on empty dicts","Only call update() from code paths where at least one field is known to have changed"],"tags":["validation","hosted-api","projects","update"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}