{"record":{"id":"07c730d5a1ccc6c2","repo":"mem0ai/mem0","slug":"at-least-one-identifier-user-id-agent-id-run-id","errorCode":null,"errorMessage":"At least one identifier (user_id, agent_id, run_id) is required.","messagePattern":"At least one identifier \\(user_id, agent_id, run_id\\) is required\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"server/main.py","lineNumber":371,"sourceCode":"            f\"TEST_MESSAGE: <your test message>\\n\\nUse case: {req.use_case}\"\n        )\n        response = llm.generate_response([{\"role\": \"user\", \"content\": prompt}])\n        instructions = response\n        test_message = \"I like to hike on weekends.\"\n        if \"INSTRUCTIONS:\" in response and \"TEST_MESSAGE:\" in response:\n            parts = response.split(\"TEST_MESSAGE:\")\n            instructions = parts[0].replace(\"INSTRUCTIONS:\", \"\").strip()\n            test_message = parts[1].strip()\n        return {\"custom_instructions\": instructions, \"test_message\": test_message}\n    except Exception:\n        raise upstream_error()\n\n\n@app.post(\"/memories\", summary=\"Create memories\")\ndef add_memory(memory_create: MemoryCreate, _auth=Depends(verify_auth)):\n    \"\"\"Store new memories.\"\"\"\n    if not any([memory_create.user_id, memory_create.agent_id, memory_create.run_id]):\n        raise HTTPException(status_code=400, detail=\"At least one identifier (user_id, agent_id, run_id) is required.\")\n\n    params = {k: v for k, v in memory_create.model_dump().items() if v is not None and k != \"messages\"}\n    try:\n        response = get_memory_instance().add(messages=[m.model_dump() for m in memory_create.messages], **params)\n        if response.get(\"results\"):\n            telemetry.log_dashboard_nudge_once(DASHBOARD_URL)\n        return JSONResponse(content=response)\n    except (ValueError, Mem0ValidationError) as e:\n        raise _client_error(e)\n    except Exception:\n        raise upstream_error()\n\n\nALL_MEMORIES_LIMIT = 1000\n_RESERVED_PAYLOAD_KEYS = {\"data\", \"user_id\", \"agent_id\", \"run_id\", \"hash\", \"created_at\", \"updated_at\", \"expiration_date\"}\n\n\ndef _serialize_memory(row: Any) -> Dict[str, Any]:","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/server/main.py#L353-L389","documentation":"Error \"At least one identifier (user_id, agent_id, run_id) is required.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at server/main.py:371 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass at least one of user_id, agent_id, or run_id in the request."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}