{"record":{"id":"33c6faa45b2fb638","repo":"BerriAI/litellm","slug":"getattr-e-detail-str-e","errorCode":null,"errorMessage":"getattr(e, \"detail\", str(e))","messagePattern":"getattr\\(e, \"detail\", str\\(e\\)\\)","errorType":"http","errorClass":"ProxyException","httpStatus":null,"severity":"error","filePath":"litellm/proxy/spend_tracking/spend_management_endpoints.py","lineNumber":2156,"sourceCode":"                _cost = completion_cost(\n                    model=_litellm_model_name,\n                    messages=request.messages,\n                    custom_cost_per_token=cost_per_token,\n                )\n            else:\n                _cost = completion_cost(model=request.model, messages=request.messages)\n        elif request.completion_response is not None:\n            _completion_response: Final = litellm.ModelResponse(**request.completion_response)\n            _cost = completion_cost(completion_response=_completion_response)\n        else:\n            raise HTTPException(\n                status_code=400,\n                detail=\"Bad Request - Either 'model' or 'completion_response' must be provided\",\n            )\n        return {\"cost\": _cost}\n    except Exception as e:\n        if isinstance(e, HTTPException):\n            raise ProxyException(\n                message=getattr(e, \"detail\", str(e)),\n                type=getattr(e, \"type\", \"None\"),\n                param=getattr(e, \"param\", \"None\"),\n                code=getattr(e, \"status_code\", status.HTTP_400_BAD_REQUEST),\n            )\n        error_msg: Final = f\"{e}\"\n        raise ProxyException(\n            message=getattr(e, \"message\", error_msg),\n            type=getattr(e, \"type\", \"None\"),\n            param=getattr(e, \"param\", \"None\"),\n            code=getattr(e, \"status_code\", 500),\n        )\n\n\n@router.get(\n    \"/spend/logs/v2\",\n    tags=[\"Budget & Spend Tracking\"],\n    dependencies=[Depends(user_api_key_auth)],","sourceCodeStart":2138,"sourceCodeEnd":2174,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/spend_tracking/spend_management_endpoints.py#L2138-L2174","documentation":"Error \"getattr(e, \"detail\", str(e))\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/spend_tracking/spend_management_endpoints.py:2156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped HTTP error detail; correct the request per that message and retry."],"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-14T00:17:10.932Z"}