{"record":{"id":"a1d94abde33282c7","repo":"BerriAI/litellm","slug":"urn-litellm-error-internal-server-error","errorCode":"urn:litellm:error:internal-server-error","errorMessage":"Failed to list budgets.","messagePattern":"Failed to list budgets\\.","errorType":"http","errorClass":"ManagementProblem","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/management_v1/budgets.py","lineNumber":196,"sourceCode":"                    status=503,\n                    detail=CommonProxyErrors.db_not_connected_error.value,\n                )\n            )\n\n        return await handle_list(\n            spec=BUDGETS_LIST_SPEC,\n            executor=PrismaBudgetListExecutor(prisma_client=prisma_client),\n            request=request,\n            caller=user_api_key_dict,\n        )\n\n    except ManagementProblem:\n        raise\n    except Exception as e:  # noqa: BLE001  # a driver error answers as a problem document, not the OpenAI error shape\n        verbose_proxy_logger.exception(\n            \"litellm.proxy.management_endpoints.management_v1.budgets.list_budgets(): Exception occured - %s\", e\n        )\n        raise ManagementProblem(\n            ProblemDetail(\n                type=f\"{PROBLEM_TYPE_BASE}internal-server-error\",\n                title=\"Internal server error\",\n                status=500,\n                detail=\"Failed to list budgets.\",\n            )\n        )\n","sourceCodeStart":178,"sourceCodeEnd":204,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/management_v1/budgets.py#L178-L204","documentation":"The catch-all for GET /management/v1/budgets: any exception that is not itself a ManagementProblem (Prisma/driver errors, serialization bugs, unexpected None) is logged server-side via verbose_proxy_logger.exception and converted into a 500 RFC 9457 problem (type urn:litellm:error:internal-server-error, detail 'Failed to list budgets.'). The client gets a stable, opaque problem; the traceback lives in the proxy logs.","triggerScenarios":"Postgres restarting or hitting max_connections during the query; schema drift where the DB lacks expected budget columns (migrations not applied); a bug in a custom executor/serializer; out-of-memory or timeouts in the count/find_many calls.","commonSituations":"DB failover mid-request; deploying a new proxy version against an old unmigrated database; heavy pages (huge page_size) triggering driver timeouts.","solutions":["Pull the proxy logs for the same timestamp — the original exception and traceback are recorded there","Apply pending migrations (litellm --migrate) if the schema is behind the running version","Check DB health (connection count, disk, failover state) and retry once it is healthy","If it is reproducible with a specific query (e.g. a particular sort/filter), reduce the request to the minimal failing form and report it with logs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async def list_budgets_with_retry(client, q, attempts=3):\n    for i in range(attempts):\n        r = await client.get('/management/v1/budgets', params=q)\n        if r.status_code == 200:\n            return r.json()\n        if r.status_code == 500 and 'internal-server-error' in r.text:\n            await asyncio.sleep(2 ** i)   # transient DB/driver failure; back off and retry\n            continue\n        r.raise_for_status()\n    raise RuntimeError('list budgets kept failing with 500')","preventionTips":["Retry only idempotent GET list calls, with capped exponential backoff","Alert with the proxy-side traceback (grep verbose_proxy_logger for the timestamp), not just the client problem","Keep migrations in lockstep with the deployed proxy version to avoid schema-drift 500s"],"tags":["internal-server-error","problem-details","litellm-proxy","budgets","database"],"backgroundTag":"database-query-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}