{"record":{"id":"9a11bd58d9888c8e","repo":"infiniflow/ragflow","slug":"rate-limit-error-e","errorCode":null,"errorMessage":"Rate limit error: {e}","messagePattern":"Rate limit error: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":400,"severity":"error","filePath":"api/apps/restful_apis/agent_api.py","lineNumber":2014,"sourceCode":"\n        key = f\"rl:tb:{agent_id}\"\n        now = time.time()\n\n        try:\n            from rag.utils.redis_conn import REDIS_CONN\n\n            res = REDIS_CONN.lua_token_bucket(\n                keys=[key],\n                args=[capacity, rate, now, cost],\n                client=REDIS_CONN.REDIS,\n            )\n\n            allowed = int(res[0])\n            if allowed != 1:\n                raise Exception(\"Too many requests (rate limit exceeded)\")\n\n        except Exception as e:\n            raise Exception(f\"Rate limit error: {e}\")\n\n    def _validate_token_auth(security_cfg):\n        \"\"\"Validate header-based token authentication.\"\"\"\n        token_cfg = security_cfg.get(\"token\", {})\n        header = token_cfg.get(\"token_header\")\n        token_value = token_cfg.get(\"token_value\")\n\n        provided = request.headers.get(header)\n        if provided != token_value:\n            raise Exception(\"Invalid token authentication\")\n\n    def _validate_basic_auth(security_cfg):\n        \"\"\"Validate HTTP Basic Auth credentials.\"\"\"\n        auth_cfg = security_cfg.get(\"basic_auth\", {})\n        username = auth_cfg.get(\"username\")\n        password = auth_cfg.get(\"password\")\n\n        auth = request.authorization","sourceCodeStart":1996,"sourceCodeEnd":2032,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/apps/restful_apis/agent_api.py#L1996-L2032","documentation":"Error \"Rate limit error: {e}\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/apps/restful_apis/agent_api.py:2014 when the library encounters an invalid state.","commonSituations":"The rate limiting component fails internally, typically due to an unavailable backing store; restoring the backend service prevents this error.","solutions":["Check the rate limiter backend (e.g. Redis) is reachable and healthy.","Inspect the logged underlying error for the root cause."],"exampleFix":"# verify Redis connectivity used by the rate limiter\nredis-cli ping","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}