{
  "id": "python/starlette-request-headers-missing",
  "signature": "KeyError: 'Authorization'",
  "signature_zh": "键错误：'Authorization'",
  "regex": "KeyError:\\ 'Authorization'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "在 Starlette 中直接访问 request.headers['Authorization']，但请求未包含该头部。",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Starlette 中直接访问 request.headers['Authorization']，但请求未包含该头部。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "头部名称不区分大小写，但拼写错误会导致返回 None，后续逻辑出错。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "未处理缺失头部的情况，可能导致未授权访问。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "auth = request.headers.get('Authorization')\nif auth is None:\n    return JSONResponse({'error': 'missing'}, status_code=401)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "auth = request.headers.get('Authorization', '')",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}