BerriAI/litellm · error · HTTPException

Only proxy admins may set team_id to a different team.

Error message

Only proxy admins may set team_id to a different team.

What it means

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.

Source

Thrown at litellm/proxy/memory/memory_endpoints.py:286

    - Everyone else: the requested values must match their own (or be omitted).

    Also rejects identity-less creation: a row with both user_id and team_id
    NULL is invisible to every non-admin caller (the visibility filter would
    never match it), so we refuse to create orphan rows unless the caller is
    a PROXY_ADMIN who is explicitly stamping a global/shared row.
    """
    if _is_admin(user_api_key_dict):
        user_id = requested_user_id if requested_user_id is not None else user_api_key_dict.user_id
        team_id = requested_team_id if requested_team_id is not None else user_api_key_dict.team_id
        return user_id, team_id

    if requested_user_id is not None and requested_user_id != user_api_key_dict.user_id:
        raise HTTPException(
            status_code=403,
            detail="Only proxy admins may set user_id to a different user.",
        )
    if requested_team_id is not None and requested_team_id != user_api_key_dict.team_id:
        raise HTTPException(
            status_code=403,
            detail="Only proxy admins may set team_id to a different team.",
        )
    user_id = user_api_key_dict.user_id
    team_id = user_api_key_dict.team_id
    if not user_id and not team_id:
        # Orphan row: no user_id and no team_id means no non-admin can ever
        # see it again via the visibility filter. Reject up front.
        raise HTTPException(
            status_code=400,
            detail=(
                "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."
            ),
        )
    return user_id, team_id

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Omit team_id or set it to your own team, or call as a proxy admin.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/memory/memory_endpoints.py:286 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/6956e9d575c29d6e. Report an issue: GitHub.