{"record":{"id":"db9d18c8c3ae467b","repo":"BerriAI/litellm","slug":"cannot-create-a-memory-entry-without-a-user-id-or","errorCode":null,"errorMessage":"Cannot create a memory entry without a user_id or team_id. Authenticate with a key that has a user_id or team_id, or call as a proxy admin.","messagePattern":"Cannot create a memory entry without a user_id or team_id\\. Authenticate with a key that has a user_id or team_id, or call as a proxy admin\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":295,"sourceCode":"        team_id = requested_team_id if requested_team_id is not None else user_api_key_dict.team_id\n        return user_id, team_id\n\n    if requested_user_id is not None and requested_user_id != user_api_key_dict.user_id:\n        raise HTTPException(\n            status_code=403,\n            detail=\"Only proxy admins may set user_id to a different user.\",\n        )\n    if requested_team_id is not None and requested_team_id != user_api_key_dict.team_id:\n        raise HTTPException(\n            status_code=403,\n            detail=\"Only proxy admins may set team_id to a different team.\",\n        )\n    user_id = user_api_key_dict.user_id\n    team_id = user_api_key_dict.team_id\n    if not user_id and not team_id:\n        # Orphan row: no user_id and no team_id means no non-admin can ever\n        # see it again via the visibility filter. Reject up front.\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                \"Cannot create a memory entry without a user_id or team_id. \"\n                \"Authenticate with a key that has a user_id or team_id, or call \"\n                \"as a proxy admin.\"\n            ),\n        )\n    return user_id, team_id\n\n\n@router.post(\n    \"/v1/memory\",\n    tags=[\"memory management\"],\n    dependencies=[Depends(user_api_key_auth)],\n    response_model=LiteLLM_MemoryRow,\n)\nasync def create_memory(\n    body: MemoryCreateRequest,","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L277-L313","documentation":"HTTPException raised when creating a memory entry would produce an identity-less row: the caller has no user_id/team_id on their key and did not (or cannot, as non-admin) supply either in the body. Such orphan rows would be invisible to every visibility filter, so creation is refused.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate with a key that has a user_id or team_id, or call as a proxy admin with an explicit scope."],"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"}