{"record":{"id":"d7c4c851dec24e25","repo":"BerriAI/litellm","slug":"budget-with-id-budget-obj-budget-id-already-ex","errorCode":null,"errorMessage":"Budget with id '{budget_obj.budget_id}' already exists.","messagePattern":"Budget with id '(.+?)' already exists\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/budget_management_endpoints.py","lineNumber":108,"sourceCode":"\n    # if no budget_reset_at date is set, but a budget_duration is given, then set budget_reset_at initially to the first completed duration interval in future\n    if budget_obj.budget_reset_at is None and budget_obj.budget_duration is not None:\n        budget_obj.budget_reset_at = get_budget_reset_time(budget_duration=budget_obj.budget_duration)\n\n    budget_obj_json: Final = budget_obj.model_dump(exclude_none=True)\n    budget_obj_jsonified: Final = jsonify_object(budget_obj_json)  # json dump any dictionaries\n    try:\n        response: Final = await BudgetRepository(prisma_client).table.create(\n            data={\n                **budget_obj_jsonified,\n                \"created_by\": user_api_key_dict.user_id or litellm_proxy_admin_name,\n                \"updated_by\": user_api_key_dict.user_id or litellm_proxy_admin_name,\n            }\n        )\n    except Exception as e:\n        if not isinstance(e, UniqueViolationError):\n            raise\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": f\"Budget with id '{budget_obj.budget_id}' already exists.\"},\n        )\n\n    return response\n\n\n@router.post(\n    \"/budget/update\",\n    tags=[\"budget management\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def update_budget(\n    budget_obj: BudgetNewRequest,\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n):\n    \"\"\"\n    Update an existing budget object.","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/budget_management_endpoints.py#L90-L126","documentation":"Error \"Budget with id '{budget_obj.budget_id}' already exists.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/budget_management_endpoints.py:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different budget_id.","Update the existing budget instead of creating a duplicate."],"exampleFix":null,"handlingStrategy":null,"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"}