binary-husky/gpt_academic · warning · ValueError

Searxng(在线搜索服务)当前使用人数太多,请稍后。

Error message

Searxng(在线搜索服务)当前使用人数太多,请稍后。

What it means

The SearxNG instance answered HTTP 429, which means the request was rate limited or blocked by its bot limiter. The client raises this localized ValueError instead of parsing the body.

Source

Thrown at crazy_functions/Internet_GPT.py:164

        'X-Forwarded-For': get_auth_ip(),
        'X-Real-IP': get_auth_ip()
    }
    results = []
    response = requests.post(url, params=params, headers=headers, proxies=proxies, timeout=30)
    if response.status_code == 200:
        json_result = response.json()
        for result in json_result['results']:
            item = {
                "title": result.get("title", ""),
                "source": result.get("engines", "unknown"),
                "content": result.get("content", ""),
                "link": result["url"],
            }
            results.append(item)
        return results
    else:
        if response.status_code == 429:
            raise ValueError("Searxng(在线搜索服务)当前使用人数太多,请稍后。")
        else:
            raise ValueError("在线搜索失败,状态码: " + str(response.status_code) + '\t' + response.content.decode('utf-8'))


def scrape_text(url, proxies) -> str:
    """Scrape text from a webpage

    Args:
        url (str): The URL to scrape text from

    Returns:
        str: The scraped text
    """
    from loguru import logger
    headers = {
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36',
        'Content-Type': 'text/plain',
    }

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Wait and retry with exponential backoff, or try another URL from SEARXNG_URLS.
  2. Reduce the number of optimized queries and avoid parallel search plugins.
  3. Use a self-hosted SearxNG instance and configure its limiter for this client.
  4. Ensure the configured URL, proxy, and forwarded-header behavior match the deployment.
  5. Monitor 429 frequency and adjust SearxNG's bot_detection settings or quotas.

Example fix

# before
response = requests.post(url, params=params, headers=headers, proxies=proxies, timeout=30)
if response.status_code == 429:
    raise ValueError("Searxng(在线搜索服务)当前使用人数太多,请稍后。")

# after
for attempt in range(3):
    response = requests.post(url, params=params, headers=headers, proxies=proxies, timeout=30)
    if response.status_code != 429:
        break
    time.sleep(2 ** attempt)
Defensive patterns

Strategy: retry

Try / catch

try:
    return searxng_request(query, proxies, categories)
except ValueError as e:
    if "当前使用人数太多" in str(e):
        wait = min(30, 2 ** attempt)
        time.sleep(wait)
        return searxng_request(query, proxies, categories)
    raise

Prevention

When it happens

Trigger: search_optimizer sends several optimized queries in quick succession, multiple users share SEARXNG_URLS, or the limiter associates requests with the same forged X-Forwarded-For/X-Real-IP produced by get_auth_ip().

Common situations: Using public SearxNG instances; running parallel agents; SearxNG limiter is enabled without trusting the client; all requests appear to come from one IP; search volume exceeds the instance's configured limit.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/e9bbe970ec332ee6. Report an issue: GitHub.