{
  "id": "pip/invalid-constraint-hash",
  "signature": "ERROR: Invalid constraint: --hash=sha256:abc123...: expected a constraint line with a requirement, got a hash option",
  "signature_zh": "错误：无效的约束：--hash=sha256:abc123...：期望约束行包含需求，但得到的是哈希选项",
  "regex": "ERROR: Invalid constraint: --hash=sha256:[a-f0-9]+: expected a constraint line with a requirement, got a hash option",
  "domain": "pip",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A constraints file (constraints.txt) contains a line with only a hash option (e.g., --hash=sha256:...), but pip expects each constraint line to specify a package name and version, with the hash as an option on the same line.",
  "root_cause_type": "generic",
  "root_cause_zh": "约束文件（constraints.txt）中包含仅包含哈希选项的行（例如 --hash=sha256:...），但 pip 期望每个约束行指定一个包名和版本，哈希作为同一行的选项。",
  "versions": [
    {
      "version": "pip 23.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "pip 24.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Add the hash to a requirements.txt instead of constraints.txt",
      "why_fails": "The same syntax rules apply to requirements files; moving the line does not fix the malformed constraint entry.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use --require-hashes in constraints.txt",
      "why_fails": "The --require-hashes flag enables hash checking but does not change how constraint lines are parsed; the invalid line remains.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Rewrite the constraint line to include the package name and version: 'package==1.2.3 --hash=sha256:abc123...'",
      "success_rate": 0.95,
      "how": "Rewrite the constraint line to include the package name and version: 'package==1.2.3 --hash=sha256:abc123...'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Remove the orphaned hash line from the constraints file and regenerate hashes using: pip hash <package>.whl",
      "success_rate": 0.9,
      "how": "Remove the orphaned hash line from the constraints file and regenerate hashes using: pip hash <package>.whl",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "将约束行重写为包含包名和版本：'package==1.2.3 --hash=sha256:abc123...'",
    "从约束文件中移除孤立的哈希行，并使用以下命令重新生成哈希：pip hash <package>.whl"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pip.pypa.io/en/stable/topics/constraints-files/",
  "official_doc_section": null,
  "error_code": "ERROR",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-08-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}