{"record":{"id":"6956e9d575c29d6e","repo":"BerriAI/litellm","slug":"only-proxy-admins-may-set-team-id-to-a-different-t","errorCode":null,"errorMessage":"Only proxy admins may set team_id to a different team.","messagePattern":"Only proxy admins may set team_id to a different team\\.","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":286,"sourceCode":"    - Everyone else: the requested values must match their own (or be omitted).\n\n    Also rejects identity-less creation: a row with both user_id and team_id\n    NULL is invisible to every non-admin caller (the visibility filter would\n    never match it), so we refuse to create orphan rows unless the caller is\n    a PROXY_ADMIN who is explicitly stamping a global/shared row.\n    \"\"\"\n    if _is_admin(user_api_key_dict):\n        user_id = requested_user_id if requested_user_id is not None else user_api_key_dict.user_id\n        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","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L268-L304","documentation":"HTTPException(403) from the memory row-identity resolver: a non-admin caller set team_id in the request body to a team other than their own. Non-admins may only attach memory entries to their own team; admins may target any team.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:286 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Omit team_id or set it to your own team, 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-14T00:17:10.932Z"}