BerriAI/litellm · error · HTTPException

team_id does not exist in the database. Please specify a val

Error message

team_id does not exist in the database. Please specify a valid `team_id` in the request body.

What it means

Error "team_id does not exist in the database. Please specify a valid `team_id` in the request body." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:772

    """
    if team_id is None:
        raise HTTPException(
            status_code=400,
            detail="team_id is required for service account keys. Please specify `team_id` in the request body.",
        )

    if prisma_client is None:
        raise HTTPException(
            status_code=400,
            detail="prisma_client is required for service account keys. Please specify `prisma_client` in the request body.",
        )

    # check if team_id exists in the database
    team: Final = await _prisma_table(TeamRepository(prisma_client)).find_unique(
        where={"team_id": team_id},
    )
    if team is None:
        raise HTTPException(
            status_code=400,
            detail="team_id does not exist in the database. Please specify a valid `team_id` in the request body.",
        )
    return True


_BUDGET_NUMERIC_KEYS = frozenset(["max_budget", "soft_budget", "max_parallel_requests", "tpm_limit", "rpm_limit"])


def _enforce_upperbound_key_params(
    data: GenerateKeyRequest | UpdateKeyRequest,
    fill_defaults: bool = True,
) -> None:
    """
    Enforce upperbound limits on key parameters.

    For key generation (fill_defaults=True): fills None values with upperbound defaults.
    For key update (fill_defaults=False): only validates explicitly provided values.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the team exists via /team/list and use its exact team_id.
  2. Create the team first via /team/new, then retry.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:772 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/e92a733cbf9e458d. Report an issue: GitHub.