{
  "id": "python/aiohttp-too-many-redirects",
  "signature": "aiohttp.client_exceptions.TooManyRedirects: 0, message='Too many redirects', url=URL('https://example.com/loop')",
  "signature_zh": "aiohttp.client_exceptions.TooManyRedirects: 0, message='重定向过多', url=URL('https://example.com/loop')",
  "regex": "aiohttp\\.client_exceptions\\.TooManyRedirects:\\ 0,\\ message='Too\\ many\\ redirects',\\ url=URL\\('https://example\\.com/loop'\\)",
  "domain": "python",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The server returned more than max_redirects (default 10) redirect responses, often due to a redirect loop or cookie/auth misconfiguration.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器返回了超过 max_redirects（默认 10）次重定向响应，通常由重定向循环或 cookie/认证配置错误引起。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If it's a true loop, it will still hit 100 and fail.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "You now receive 3xx responses directly and must handle Location yourself.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Unrelated to redirect count.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Inspect the redirect chain with curl:\n\ncurl -sIL https://example.com/loop | grep -i '^location'",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Handle redirects manually to detect the loop:\n\nasync with session.get(url, allow_redirects=False) as r:\n    while r.status in (301, 302, 303, 307, 308):\n        url = r.headers['Location']\n        r = await session.get(url, allow_redirects=False)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.82,
      "how": "Ensure cookies are sent (some redirect loops happen because auth cookie is missing):\n\nsession.cookie_jar.update_cookies({'session': token})",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}