{"record":{"id":"5794f4351c435487","repo":"BerriAI/litellm","slug":"failed-to-cancel-polling-response","errorCode":null,"errorMessage":"Failed to cancel polling response","messagePattern":"Failed to cancel polling response","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/response_api_endpoints/endpoints.py","lineNumber":1101,"sourceCode":"        polling_handler: Final = ResponsePollingHandler(redis_cache=redis_usage_cache)\n\n        # Get current state to verify it exists\n        state: Final = await polling_handler.get_state(response_id)\n\n        if not state:\n            raise HTTPException(status_code=404, detail=f\"Polling response {response_id} not found\")\n\n        # Cancel the polling response (sets status to \"cancelled\")\n        success: Final = await polling_handler.cancel_polling(response_id)\n\n        if success:\n            # Fetch the updated state with cancelled status\n            updated_state: Final = await polling_handler.get_state(response_id)\n\n            # Return the whole state directly (now with status=\"cancelled\")\n            return updated_state\n        else:\n            raise HTTPException(status_code=500, detail=\"Failed to cancel polling response\")\n\n    # Normal provider response flow\n    data: Final = await _read_request_body(request=request)\n    data[\"response_id\"] = response_id\n    processor: Final = ProxyBaseLLMRequestProcessing(data=data)\n    try:\n        return await processor.base_process_llm_request(\n            request=request,\n            fastapi_response=fastapi_response,\n            user_api_key_dict=user_api_key_dict,\n            route_type=\"acancel_responses\",\n            proxy_logging_obj=proxy_logging_obj,\n            llm_router=llm_router,\n            general_settings=general_settings,\n            proxy_config=proxy_config,\n            select_data_generator=select_data_generator,\n            model=None,\n            user_model=user_model,","sourceCodeStart":1083,"sourceCodeEnd":1119,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/response_api_endpoints/endpoints.py#L1083-L1119","documentation":"Polling cancellation failure: the polling response exists (state was loaded), but ResponsePollingHandler.cancel_polling returned failure — marking the response as 'cancelled' in Redis did not succeed; the cancel operation aborts with an error.","triggerScenarios":"Thrown at litellm/proxy/response_api_endpoints/endpoints.py:1101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check logs and Redis/provider connectivity; the background job may have already completed or failed."],"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-14T00:17:10.932Z"}