{"record":{"id":"20a2a07fb3cf32e1","repo":"BerriAI/litellm","slug":"organization-not-found-organization-id-an-orga","errorCode":null,"errorMessage":"Organization not found: {organization_id}. An organization must exist before it can be set as the default organization for new teams.","messagePattern":"Organization not found: (.+?)\\. An organization must exist before it can be set as the default organization for new teams\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py","lineNumber":750,"sourceCode":"    Teams are created from these settings long after they are saved, and an unknown\n    organization id would fail every future team creation instead of here, where the\n    admin who typed it can still fix it.\n    \"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(\n            status_code=500,\n            detail={  # mutable-ok: HTTPException detail must be a plain dict for FastAPI JSON serialization\n                \"error\": \"Database not connected. Please connect a database.\"\n            },\n        )\n\n    organization_exists: Final = await OrganizationRepository(prisma_client).exists(\n        organization_id, id_field=\"organization_id\"\n    )\n    if not organization_exists:\n        raise HTTPException(\n            status_code=400,\n            detail={  # mutable-ok: HTTPException detail must be a plain dict for FastAPI JSON serialization\n                \"error\": f\"Organization not found: {organization_id}. \"\n                \"An organization must exist before it can be set as the default organization for new teams.\"\n            },\n        )\n\n\nasync def update_default_team_member_budget(teams: list[NewUserRequestTeam], user_api_key_dict: UserAPIKeyAuth):\n    \"\"\"\n    1. Update the max member budget for the team\n    \"\"\"\n    from fastapi import Request\n\n    from litellm.proxy.management_endpoints.team_endpoints import update_team\n\n    for team in teams:\n        team_id = team.team_id","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py#L732-L768","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:750 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the organization first (via /organization/new) or correct the organization_id."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}