{
  "id": "go/json-unexpected-end-of-json-input",
  "signature": "json: unexpected end of JSON input",
  "signature_zh": "json：意外的 JSON 输入结束",
  "regex": "json: unexpected end of JSON input",
  "domain": "go",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The JSON decoder encountered the end of the input stream before completing the parsing of a valid JSON value.",
  "root_cause_type": "generic",
  "root_cause_zh": "JSON 解码器在完成有效 JSON 值的解析之前遇到了输入流的结束。",
  "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"
    },
    {
      "version": "go1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding more fields to the Go struct to match the expected JSON.",
      "why_fails": "The error is about incomplete input, not missing fields; adding fields doesn't fix malformed or truncated data.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using json.Unmarshal with a string that includes extra whitespace.",
      "why_fails": "Whitespace is ignored by the decoder; the input must be a complete JSON value.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check the source of the JSON data to ensure it is complete (e.g., full HTTP response body, complete file read). Use io.ReadAll to read all data before unmarshaling.",
      "success_rate": 0.9,
      "how": "Check the source of the JSON data to ensure it is complete (e.g., full HTTP response body, complete file read). Use io.ReadAll to read all data before unmarshaling.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use json.Decoder with a buffered reader and check for io.ErrUnexpectedEOF specifically to provide a better error message.",
      "success_rate": 0.85,
      "how": "Use json.Decoder with a buffered reader and check for io.ErrUnexpectedEOF specifically to provide a better error message.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check the source of the JSON data to ensure it is complete (e.g., full HTTP response body, complete file read). Use io.ReadAll to read all data before unmarshaling.",
    "Use json.Decoder with a buffered reader and check for io.ErrUnexpectedEOF specifically to provide a better error message."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pkg.go.dev/encoding/json#Decoder.Decode",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}