{
  "id": "python/pytest-recursion-error-fixture-cycle",
  "signature": "RecursionError: maximum recursion depth exceeded while calling a Python object\n\n...\nconftest.py:10: in db\n    request.getfixturevalue('db')\nconftest.py:10: in db\n    request.getfixturevalue('db')\n...",
  "signature_zh": "RecursionError: 调用 Python 对象时超出最大递归深度\n\n...\nconftest.py:10: in db\n    request.getfixturevalue('db')\nconftest.py:10: in db\n    request.getfixturevalue('db')\n...",
  "regex": "RecursionError:\\ maximum\\ recursion\\ depth\\ exceeded\\ while\\ calling\\ a\\ Python\\ object\\\n\\\n\\.\\.\\.\\\nconftest\\.py:10:\\ in\\ db\\\n\\ \\ \\ \\ request\\.getfixturevalue\\('db'\\)\\\nconftest\\.py:10:\\ in\\ db\\\n\\ \\ \\ \\ request\\.getfixturevalue\\('db'\\)\\\n\\.\\.\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A fixture calls request.getfixturevalue() with its own name, creating an infinite recursion. This often happens when refactoring fixtures and accidentally referencing the wrong name.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个 fixture 调用 request.getfixturevalue() 时传入了自身的名称，导致无限递归。这通常发生在重构 fixture 时意外引用了错误的名称。",
  "versions": [
    {
      "version": "6.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Delays the crash but the infinite recursion still exhausts memory and eventually raises RecursionError or crashes the interpreter.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The recursion happens during fixture resolution before the try block can catch it in a useful way.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "@pytest.fixture\ndef db(request):\n    engine = request.getfixturevalue('engine')  # not 'db'\n    return engine.connect()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "@pytest.fixture\ndef db(engine):  # pytest injects engine directly\n    return engine.connect()",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-26",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}