{
  "id": "python/pytest-parametrize-id-duplicate",
  "signature": "ValueError: duplicate 'test_id' in parametrize",
  "signature_zh": "ValueError: 在 parametrize 中重复的 'test_id'",
  "regex": "ValueError:\\ duplicate\\ 'test_id'\\ in\\ parametrize",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Two or more parametrized cases have the same ID, either explicitly set via ids 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": "If the parameter values are identical, pytest still generates duplicate IDs.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The duplication is within the same test's parametrization, not across tests.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "@pytest.mark.parametrize('x', [1, 1], ids=['first', 'second'])\ndef test_foo(x): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def idfn(val):\n    return f'val-{val}-{uuid.uuid4()}'\n\n@pytest.mark.parametrize('x', [1, 1], ids=idfn)",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}