infiniflow/ragflow · error · Exception

Too many requests (rate limit exceeded)

Error message

Too many requests (rate limit exceeded)

What it means

Error "Too many requests (rate limit exceeded)" thrown in infiniflow/ragflow.

Source

Thrown at api/apps/restful_apis/agent_api.py:2011

        capacity = limit
        rate = limit / window
        cost = 1

        key = f"rl:tb:{agent_id}"
        now = time.time()

        try:
            from rag.utils.redis_conn import REDIS_CONN

            res = REDIS_CONN.lua_token_bucket(
                keys=[key],
                args=[capacity, rate, now, cost],
                client=REDIS_CONN.REDIS,
            )

            allowed = int(res[0])
            if allowed != 1:
                raise Exception("Too many requests (rate limit exceeded)")

        except Exception as e:
            raise Exception(f"Rate limit error: {e}")

    def _validate_token_auth(security_cfg):
        """Validate header-based token authentication."""
        token_cfg = security_cfg.get("token", {})
        header = token_cfg.get("token_header")
        token_value = token_cfg.get("token_value")

        provided = request.headers.get(header)
        if provided != token_value:
            raise Exception("Invalid token authentication")

    def _validate_basic_auth(security_cfg):
        """Validate HTTP Basic Auth credentials."""
        auth_cfg = security_cfg.get("basic_auth", {})
        username = auth_cfg.get("username")

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Reduce the request rate or implement exponential backoff and retry.
  2. Raise the webhook rate limit if the traffic is legitimate.

Example fix

import time
# on 429: time.sleep(backoff); retry

When it happens

Trigger: Thrown at api/apps/restful_apis/agent_api.py:2011 when the library encounters an invalid state.

Common situations: A webhook caller exceeds the configured requests-per-period allowance; throttling the client prevents this error.

Understand the failure class


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/cffc71db862d22aa. Report an issue: GitHub.