{
  "id": "python/requests-jsondecodeerror-invalid-response",
  "signature": "requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) while parsing response from 'https://api.example.com/v1/data'",
  "signature_zh": "requests.exceptions.JSONDecodeError: 期望值：第1行第1列（字符0），解析来自'https://api.example.com/v1/data'的响应时出错",
  "regex": "requests\\.exceptions\\.JSONDecodeError:\\ Expecting\\ value:\\ line\\ 1\\ column\\ 1\\ \\(char\\ 0\\)\\ while\\ parsing\\ response\\ from\\ 'https://api\\.example\\.com/v1/data'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The server returned a non-JSON response (e.g., HTML error page) but the client expects JSON.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器返回了非JSON响应（例如HTML错误页面），但客户端期望JSON。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using json.loads() directly on response.text without checking status",
      "why_fails": "The response may be an error page, not JSON, causing the same decode error.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting a custom decoder with strict=False",
      "why_fails": "The response is not JSON at all, so no decoder can parse it.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Check the response status code and content type before parsing JSON",
      "success_rate": 0.95,
      "how": "response = requests.get('https://api.example.com/v1/data')\nif response.status_code == 200 and 'application/json' in response.headers.get('Content-Type', ''):\n    data = response.json()\nelse:\n    print('Unexpected response:', response.text)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use response.raise_for_status() to catch HTTP errors before parsing",
      "success_rate": 0.9,
      "how": "response = requests.get('https://api.example.com/v1/data')\nresponse.raise_for_status()\ndata = response.json()",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-14",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}