{"record":{"id":"b19a83a54d3462eb","repo":"BerriAI/litellm","slug":"you-do-not-have-permission-to-modify-this-memory-e","errorCode":null,"errorMessage":"You do not have permission to modify this memory entry.","messagePattern":"You do not have permission to modify this memory entry\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":201,"sourceCode":"      Plain team members can only READ team rows, not modify them — same\n      pattern as `_validate_team_member_add_permissions` etc.\n    - Anything else: 403.\n    \"\"\"\n    if _is_admin(user_api_key_dict):\n        return\n    row_user_id: Final = getattr(row, \"user_id\", None)\n    row_team_id: Final = getattr(row, \"team_id\", None)\n\n    # Personal ownership.\n    if row_user_id and row_user_id == user_api_key_dict.user_id:\n        return\n\n    # Pure team row — only team admins (or org admins) may write.\n    if row_user_id is None and row_team_id is not None:\n        if await _is_team_admin_for(prisma_client, user_api_key_dict, row_team_id):\n            return\n\n    raise HTTPException(\n        status_code=403,\n        detail=\"You do not have permission to modify this memory entry.\",\n    )\n\n\nasync def _is_team_admin_for(prisma_client: \"PrismaClient\", user_api_key_dict: UserAPIKeyAuth, team_id: str) -> bool:\n    \"\"\"\n    True if the caller is a team admin of `team_id`, or an org admin for the\n    team's organization. Mirrors the auth pattern used by team-management\n    endpoints (`_is_user_team_admin` + `_is_user_org_admin_for_team`).\n\n    Imported lazily to avoid a circular import with proxy_server during the\n    memory router's module load.\n    \"\"\"\n    from litellm.proxy.management_endpoints.common_utils import (\n        _is_user_org_admin_for_team,\n        _is_user_team_admin,\n    )","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L183-L219","documentation":"HTTPException(403) from the memory-entry write-access check: the caller is not an admin and does not own the row — the row's user_id belongs to someone else, or it is a team row and the caller is not a team admin. Plain team members may read team rows but not modify them.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:201 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Modify the entry with the key/user that owns it, or call as a proxy admin."],"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"}