{"record":{"id":"3166cad5a46e1399","repo":"BerriAI/litellm","slug":"failed-to-fetch-agentops-token-response-text","errorCode":null,"errorMessage":"Failed to fetch AgentOps token: {response.text}","messagePattern":"Failed to fetch AgentOps token: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/otel/presets/agentops.py","lineNumber":128,"sourceCode":"            return super().export(spans)\n\n    options: Final = spec.options or {}\n    return _LazyAuthAgentOpsExporter(endpoint=spec.endpoint, api_key=options.get(\"api_key\"))\n\n\ndef _fetch_agentops_jwt(api_key: str) -> dict[str, Any]:\n    # Own a short-lived client rather than ``_get_httpx_client()``: that returns\n    # a process-wide cached ``HTTPHandler`` whose connection pool is shared by\n    # every caller, so closing it here would break concurrent/subsequent\n    # requests. This one-shot auth call gets its own client to close.\n    with httpx.Client(timeout=10) as client:\n        response: Final = client.post(\n            url=_AGENTOPS_AUTH_ENDPOINT,\n            headers={\"Content-Type\": \"application/json\", \"Connection\": \"keep-alive\"},\n            json={\"api_key\": api_key},\n        )\n        if response.status_code != 200:\n            raise RuntimeError(f\"Failed to fetch AgentOps token: {response.text}\")\n        return response.json()\n\n\nregister_exporter_factory(_AGENTOPS_EXPORTER_KIND, _build_agentops_exporter)\n","sourceCodeStart":110,"sourceCodeEnd":133,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/otel/presets/agentops.py#L110-L133","documentation":"Error \"Failed to fetch AgentOps token: {response.text}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/integrations/otel/presets/agentops.py:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the AgentOps API key and endpoint; see the response text for details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}