{
  "id": "python/pytest-parametrize-id-conflict",
  "signature": "ValueError: duplicate 'test_id' in parametrize",
  "signature_zh": "ValueError: parametrize 中的 'test_id' 重复",
  "regex": "ValueError:\\ duplicate\\ 'test_id'\\ in\\ parametrize",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Two or more parametrized test cases have the same ID, either explicitly set via the ids argument or generated automatically from identical parameter values.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个或多个参数化测试用例具有相同的 ID，可能是通过 ids 参数显式设置，或从相同的参数值自动生成。",
  "versions": [
    {
      "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": "pytest will still generate duplicate IDs if the parameter values are identical, causing the same error.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The conflict is in the parametrize IDs, not the test function name. Renaming the function does not resolve the duplicate ID.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "@pytest.mark.parametrize('x,y', [(1,2), (1,2)], ids=['case1', 'case2'])\ndef test_add(x, y):\n    assert x + y == 3",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "@pytest.mark.parametrize('x,y,case', [(1,2,'a'), (1,2,'b')])\ndef test_add(x, y, case):\n    assert x + y == 3",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}