{
  "id": "python/pytest-parametrize-valueerror",
  "signature": "ValueError: The number of names (2) and values (3) must match",
  "signature_zh": "ValueError: 名称数量 (2) 和值数量 (3) 必须匹配",
  "regex": "ValueError:\\ The\\ number\\ of\\ names\\ \\(2\\)\\ and\\ values\\ \\(3\\)\\ must\\ match",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The @pytest.mark.parametrize decorator has a mismatch between the number of parameter names and the number of values in a tuple.",
  "root_cause_type": "generic",
  "root_cause_zh": "@pytest.mark.parametrize 装饰器中参数名称的数量与元组中的值的数量不匹配。",
  "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": "This can lead to confusing test results and unused parameters that obscure the test's purpose.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This changes the structure of the parameterization, often causing type errors or unexpected test cases.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Ensure each tuple in the values list has exactly the same number of elements as names: `@pytest.mark.parametrize('a,b', [(1,2), (3,4)])`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use a dictionary for named parameters if the count is variable: `@pytest.mark.parametrize('test_input,expected', [{'test_input': 1, 'expected': 2}])`",
      "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-07-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}