{
  "id": "go/invalid-utf-8-rune-string",
  "signature": "invalid UTF-8 rune string: \"\\xff\"",
  "signature_zh": "无效的UTF-8符文串：\"\\xff\"",
  "regex": "invalid UTF-8 rune string: \"[^\"]*\"",
  "domain": "go",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "Attempting to decode a byte sequence that is not valid UTF-8, often from external data sources like network streams or file reads without proper encoding handling.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试解码非有效UTF-8的字节序列，通常来自未正确处理编码的外部数据源，如网络流或文件读取。",
  "versions": [
    {
      "version": "Go 1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Binary data cannot be safely represented as UTF-8 strings; this leads to data corruption and runtime panics.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "These operations still expect valid UTF-8 and will produce the same error or silently corrupt data.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use strings.ToValidUTF8() to replace invalid bytes with the Unicode replacement character U+FFFD",
      "success_rate": 0.85,
      "how": "Use strings.ToValidUTF8() to replace invalid bytes with the Unicode replacement character U+FFFD",
      "condition": "",
      "sources": []
    },
    {
      "action": "Read data as []byte and decode with utf8.Valid() validation before string conversion",
      "success_rate": 0.9,
      "how": "Read data as []byte and decode with utf8.Valid() validation before string conversion",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use strings.ToValidUTF8() to replace invalid bytes with the Unicode replacement character U+FFFD",
    "Read data as []byte and decode with utf8.Valid() validation before string conversion"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pkg.go.dev/unicode/utf8#DecodeRune",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.78,
  "resolvable": "partial",
  "first_seen": "2024-03-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}