{"record":{"id":"0fd78696e8e1bf99","repo":"BerriAI/litellm","slug":"request-body-must-include-at-least-one-of-value","errorCode":null,"errorMessage":"Request body must include at least one of: value, metadata.","messagePattern":"Request body must include at least one of: value, metadata\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":477,"sourceCode":"    # is encoded as the JSON literal `null` instead — stored as Postgres\n    # `jsonb 'null'`, which prisma deserializes back to Python `None` on\n    # read. From a caller's perspective `PUT {\"metadata\": null}` clears\n    # the field (subsequent reads return `metadata: null`), matching the\n    # natural expectation. Callers wanting a strict SQL NULL must use\n    # raw SQL — there is no typed-client path.\n    #\n    # When `metadata` is omitted from the request body entirely (not in\n    # `model_fields_set`), the column is preserved as-is.\n    fields_sent: Final = body.model_fields_set\n    metadata_in_payload: Final = \"metadata\" in fields_sent\n\n    data: Final[dict[str, object]] = {}\n    if body.value is not None:\n        data[\"value\"] = body.value\n    if metadata_in_payload:\n        data[\"metadata\"] = _serialize_metadata_for_prisma(body.metadata)\n    if not data:\n        raise HTTPException(\n            status_code=400,\n            detail=\"Request body must include at least one of: value, metadata.\",\n        )\n    data[\"updated_by\"] = user_api_key_dict.user_id\n\n    async def _find_existing() -> _MemoryRecord | None:\n        \"\"\"Return the caller-visible row for `key`, or None.\"\"\"\n        try:\n            return await _find_memory_for_caller(prisma_client, key, user_api_key_dict)\n        except HTTPException as e:\n            if e.status_code == 404:\n                return None\n            raise\n\n    try:\n        existing: Final = await _find_existing()\n        if existing is not None:\n            # Visibility != write authority. Make sure the caller actually","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L459-L495","documentation":"HTTPException raised on PUT of a memory entry when the request body contains neither 'value' nor 'metadata' (nothing in model_fields_set to write). The update would be a no-op, so the request is rejected as malformed instead of issuing an empty database write.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:477 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include at least one of 'value' or 'metadata' in the request body."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}