{"record":{"id":"a4472414096fdf84","repo":"BerriAI/litellm","slug":"cannot-create-a-new-memory-via-put-without-a-valu","errorCode":null,"errorMessage":"Cannot create a new memory via PUT without a 'value'.","messagePattern":"Cannot create a new memory via PUT without a 'value'\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":506,"sourceCode":"            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\n            # owns this row (their user_id matches, or it's a pure team row in\n            # their team) — otherwise a teammate could overwrite a personal\n            # entry through the OR-based visibility filter.\n            await _assert_write_access(prisma_client, existing, user_api_key_dict)\n            row = await _memory_table(prisma_client).update(\n                where={\"memory_id\": existing.memory_id},\n                data=data,\n            )\n        else:\n            if body.value is None:\n                raise HTTPException(\n                    status_code=400,\n                    detail=\"Cannot create a new memory via PUT without a 'value'.\",\n                )\n            # PUT-create must honor admin scope override, matching POST semantics.\n            user_id, team_id = _resolve_scope(user_api_key_dict, body.user_id, body.team_id)\n            # Omit `metadata` when None so the column defaults to SQL NULL;\n            # otherwise JSON-encode for Prisma — same pattern as\n            # `create_memory` above.\n            create_data: Final[dict[str, object]] = {\n                \"key\": key,\n                \"value\": body.value,\n                \"user_id\": user_id,\n                \"team_id\": team_id,\n                \"created_by\": user_api_key_dict.user_id,\n                \"updated_by\": user_api_key_dict.user_id,\n            }\n            if body.metadata is not None:\n                create_data[\"metadata\"] = _serialize_metadata_for_prisma(body.metadata)","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L488-L524","documentation":"HTTPException raised on PUT when the target memory row does not exist and the request body lacks a 'value' — PUT cannot create a new entry without content, since only 'metadata' was supplied. The caller must include a value to create-or-replace the key.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:506 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include a 'value' in the PUT body when creating a new memory entry."],"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-14T05:17:10.506Z"}