BerriAI/litellm · error · HTTPException

team_id in body ({data.team_id}) does not match team_id in p

Error message

team_id in body ({data.team_id}) does not match team_id in path ({team_id})

What it means

Error "team_id in body ({data.team_id}) does not match team_id in path ({team_id})" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/team_endpoints.py:2309

    curl --location --request PATCH 'http://0.0.0.0:4000/team/8d916b1c-510d-4894-a334-1c16a93344f5' \
    --header 'Authorization: Bearer sk-1234' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "metadata": {"cost_center": "1234", "deprecated_key": null}
    }'
    ```
    """
    from litellm.proxy.proxy_server import prisma_client

    try:
        if prisma_client is None:
            raise HTTPException(
                status_code=500,
                detail={"error": CommonProxyErrors.db_not_connected_error.value},
            )

        if data.team_id is not None and data.team_id != team_id:
            raise HTTPException(
                status_code=400,
                detail={"error": f"team_id in body ({data.team_id}) does not match team_id in path ({team_id})"},
            )

        patch_fields: Final = data.model_dump(exclude_unset=True, exclude={"team_id"})

        if "metadata" in patch_fields:
            existing_team_row: Final = await _team_db(prisma_client).find_unique(where={"team_id": team_id})
            if existing_team_row is None:
                raise HTTPException(
                    status_code=404,
                    detail={"error": f"Team not found, passed team_id={team_id}"},
                )
            existing_metadata = existing_team_row.metadata if isinstance(existing_team_row.metadata, dict) else {}
            patch_fields["metadata"] = apply_json_merge_patch(existing_metadata, patch_fields["metadata"])

        update_request: Final = UpdateTeamRequest.model_validate({"team_id": team_id, **patch_fields})

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Make the team_id in the request body match the team_id in the URL path, or omit it from the body.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:2309 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/cb11ac8c97713d6b. Report an issue: GitHub.