{
  "id": "python/pip-unicode-decode-error-requirements",
  "signature": "ERROR: Exception:\nTraceback (most recent call last):\n  File \"/usr/lib/python3/dist-packages/pip/_internal/req/req_file.py\", line 84, in parse_requirements\n    line = line.decode('utf-8')\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte",
  "signature_zh": "错误：异常：\n回溯（最近一次调用最后）：\n  文件 \"/usr/lib/python3/dist-packages/pip/_internal/req/req_file.py\"，第 84 行，在 parse_requirements 中\n    line = line.decode('utf-8')\nUnicodeDecodeError：'utf-8' 编解码器无法解码位置 0 中的字节 0xff：无效起始字节",
  "regex": "ERROR:\\ Exception:\\\nTraceback\\ \\(most\\ recent\\ call\\ last\\):\\\n\\ \\ File\\ \"/usr/lib/python3/dist\\-packages/pip/_internal/req/req_file\\.py\",\\ line\\ 84,\\ in\\ parse_requirements\\\n\\ \\ \\ \\ line\\ =\\ line\\.decode\\('utf\\-8'\\)\\\nUnicodeDecodeError:\\ 'utf\\-8'\\ codec\\ can't\\ decode\\ byte\\ 0xff\\ in\\ position\\ 0:\\ invalid\\ start\\ byte",
  "domain": "python",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The requirements file is not encoded in UTF-8, often due to Windows tools saving as UTF-16 or Latin-1.",
  "root_cause_type": "generic",
  "root_cause_zh": "需求文件不是 UTF-8 编码，通常由于 Windows 工具保存为 UTF-16 或 Latin-1。",
  "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": "Loses content; may not fix encoding if the tool saves in wrong format again.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Still reads the file and fails on encoding.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Convert the file to UTF-8: `iconv -f UTF-16 -t UTF-8 requirements.txt > requirements_utf8.txt`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "In a text editor, save as UTF-8 without BOM.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}