{
  "id": "go/encoding-xml-unmarshal-unknown-attribute",
  "signature": "xml: unknown attribute \"foo\"",
  "signature_zh": "xml: 未知属性 \"foo\"",
  "regex": "xml: unknown attribute \"[^\"]+\"",
  "domain": "go",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The XML decoder encountered an attribute in the input that does not map to any field in the target struct.",
  "root_cause_type": "generic",
  "root_cause_zh": "XML 解码器在输入中遇到了一个未映射到目标结构体任何字段的属性。",
  "versions": [
    {
      "version": "go1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding a field with xml:\"foo,attr\" but with wrong type",
      "why_fails": "If the field type doesn't match the attribute value (e.g., int vs string), it still fails with type error.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring the error and continuing",
      "why_fails": "The unmarshal returns an error; ignoring it leads to incomplete or nil data.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a field with the attribute tag: Foo string `xml:\"foo,attr\"` in the struct.",
      "success_rate": 0.95,
      "how": "Add a field with the attribute tag: Foo string `xml:\"foo,attr\"` in the struct.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a custom unmarshaler or XMLDecoder with strict=false if using custom parser.",
      "success_rate": 0.7,
      "how": "Use a custom unmarshaler or XMLDecoder with strict=false if using custom parser.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在结构体中添加具有属性标签的字段：Foo string `xml:\"foo,attr\"`。",
    "使用自定义反序列化器或设置 XMLDecoder 的 strict=false（如果使用自定义解析器）。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pkg.go.dev/encoding/xml#Unmarshal",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}