{
  "id": "python/fastapi-background-task-exception-silent",
  "signature": "Exception in thread Thread-1 (run) ... AttributeError: 'NoneType' object has no attribute 'send'",
  "signature_zh": "后台线程异常：AttributeError: 'NoneType'对象没有属性'send'",
  "regex": "Exception\\ in\\ thread\\ Thread\\-1\\ \\(run\\)\\ \\.\\.\\.\\ AttributeError:\\ 'NoneType'\\ object\\ has\\ no\\ attribute\\ 'send'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A background task raised an exception after the response was sent; Starlette logs it but the client never sees it.",
  "root_cause_type": "generic",
  "root_cause_zh": "后台任务在响应发送后抛出异常；Starlette会记录但客户端看不到。",
  "versions": [
    {
      "version": "0.100.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "0.110.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Background tasks cannot return responses to the client.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Still runs after response; exceptions remain invisible to client.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def task():\\n    try:\\n        work()\\n    except Exception:\\n        logger.exception('bg failed')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.92,
      "how": "@celery.task\\ndef task(): ...\\ntask.delay()",
      "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-07",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}