{
  "id": "java/jackson-jsonparseexception-unexpected-char",
  "signature": "com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')",
  "signature_zh": "com.fasterxml.jackson.core.JsonParseException: 意外字符 ('<' (代码 60)): 期望一个有效值（JSON 字符串、数字、数组、对象或标记 'null'、'true' 或 'false'）",
  "regex": "com\\.fasterxml\\.jackson\\.core\\.JsonParseException: Unexpected character \\('<' \\(code 60\\)\\): expected a valid value",
  "domain": "java",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Jackson is trying to parse a response or input that contains non-JSON content, typically an HTML page (starting with '<') instead of valid JSON, often due to an incorrect URL, server error response, or missing API endpoint.",
  "root_cause_type": "generic",
  "root_cause_zh": "Jackson 尝试解析包含非 JSON 内容的响应或输入，通常是一个 HTML 页面（以 '<' 开头）而不是有效的 JSON，通常是由于错误的 URL、服务器错误响应或缺少 API 端点。",
  "versions": [
    {
      "version": "Jackson 2.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Jackson 2.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Jackson 2.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Jackson 2.16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Add @JsonIgnoreProperties(ignoreUnknown = true) to the POJO class",
      "why_fails": "This annotation ignores unknown JSON properties but does not help when the input is not JSON at all (e.g., HTML).",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase the Jackson parsing leniency with ObjectMapper.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)",
      "why_fails": "These features relax JSON syntax rules but still require valid JSON structure; they cannot parse HTML.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrap the parsing in a try-catch and return an empty object",
      "why_fails": "This hides the error but does not address the root cause (the server returning HTML). The application may behave incorrectly.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check the actual response from the server by logging the raw response string before parsing. For example: System.out.println(\"Response: \" + responseBody); and verify the URL or API endpoint.",
      "success_rate": 0.85,
      "how": "Check the actual response from the server by logging the raw response string before parsing. For example: System.out.println(\"Response: \" + responseBody); and verify the URL or API endpoint.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a debug proxy like Fiddler or Charles Proxy to capture the HTTP response and confirm it's HTML instead of JSON. Then fix the request URL or handle HTTP error codes (e.g., 404, 500) gracefully.",
      "success_rate": 0.9,
      "how": "Use a debug proxy like Fiddler or Charles Proxy to capture the HTTP response and confirm it's HTML instead of JSON. Then fix the request URL or handle HTTP error codes (e.g., 404, 500) gracefully.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a response content-type check before parsing: if (response.getHeader(\"Content-Type\").contains(\"application/json\")) { parse; } else { handle error; }",
      "success_rate": 0.8,
      "how": "Add a response content-type check before parsing: if (response.getHeader(\"Content-Type\").contains(\"application/json\")) { parse; } else { handle error; }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Check the actual response from the server by logging the raw response string before parsing. For example: System.out.println(\"Response: \" + responseBody); and verify the URL or API endpoint.",
    "Use a debug proxy like Fiddler or Charles Proxy to capture the HTTP response and confirm it's HTML instead of JSON. Then fix the request URL or handle HTTP error codes (e.g., 404, 500) gracefully.",
    "Add a response content-type check before parsing: if (response.getHeader(\"Content-Type\").contains(\"application/json\")) { parse; } else { handle error; }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://fasterxml.github.io/jackson-core/javadoc/2.14/com/fasterxml/jackson/core/JsonParseException.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2024-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}