BerriAI/litellm · error · HTTPException

Cannot associate a user_id to this action. Check `/key/info`

Error message

Cannot associate a user_id to this action. Check `/key/info` to validate if 'user_id' is set.

What it means

Identity guard on organization update: the operation must record who changed the org, but the caller's key has no user_id set (check /key/info). Without a user_id the update cannot be attributed, so it is rejected with 400.

Source

Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:627

    response_model=LiteLLM_OrganizationTableWithMembers,
)
async def update_organization(
    request: Request,
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
    """
    Update an organization
    """
    from litellm.proxy.proxy_server import prisma_client

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

    if user_api_key_dict.user_id is None:
        raise HTTPException(
            status_code=400,
            detail={
                "error": "Cannot associate a user_id to this action. Check `/key/info` to validate if 'user_id' is set."
            },
        )

    # Transform UI payload to expected format
    raw_data: Final = await request.json()
    raw_data_with_flat_budget_fields: Final = handle_nested_budget_structure_in_organization_update_request(raw_data)

    # Create validated data model
    data: Final = LiteLLM_OrganizationTableUpdate(**raw_data_with_flat_budget_fields)

    # Validate budget values are not negative
    if data.max_budget is not None and (not math.isfinite(data.max_budget) or data.max_budget < 0):
        raise HTTPException(
            status_code=400,
            detail={"error": f"max_budget must be a non-negative finite number. Received: {data.max_budget}"},

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a key with user_id set; check /key/info to validate.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:627 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/5afbddddb0cce858. Report an issue: GitHub.