BerriAI/litellm · error · HTTPException

Organization not found: {organization_id}. An organization m

Error message

Organization not found: {organization_id}. An organization must exist before it can be set as the default organization for new teams.

What it means

Referential-integrity check for the default organization setting: the configured organization_id has no row in LiteLLM_OrganizationTable. Teams created later from these settings would all fail organization assignment, so the unknown id is rejected at save time where the admin can correct it.

Source

Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:750

    Teams are created from these settings long after they are saved, and an unknown
    organization id would fail every future team creation instead of here, where the
    admin who typed it can still fix it.
    """
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(
            status_code=500,
            detail={  # mutable-ok: HTTPException detail must be a plain dict for FastAPI JSON serialization
                "error": "Database not connected. Please connect a database."
            },
        )

    organization_exists: Final = await OrganizationRepository(prisma_client).exists(
        organization_id, id_field="organization_id"
    )
    if not organization_exists:
        raise HTTPException(
            status_code=400,
            detail={  # mutable-ok: HTTPException detail must be a plain dict for FastAPI JSON serialization
                "error": f"Organization not found: {organization_id}. "
                "An organization must exist before it can be set as the default organization for new teams."
            },
        )


async def update_default_team_member_budget(teams: list[NewUserRequestTeam], user_api_key_dict: UserAPIKeyAuth):
    """
    1. Update the max member budget for the team
    """
    from fastapi import Request

    from litellm.proxy.management_endpoints.team_endpoints import update_team

    for team in teams:
        team_id = team.team_id

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Create the organization first (via /organization/new) or correct the organization_id.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:750 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/20a2a07fb3cf32e1. Report an issue: GitHub.