{
  "id": "python/asyncio-taskgroup-exceptiongroup",
  "signature": "ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)",
  "signature_zh": "ExceptionGroup: TaskGroup 中存在未处理的错误（1 个子异常）",
  "regex": "ExceptionGroup:\\ unhandled\\ errors\\ in\\ a\\ TaskGroup\\ \\(1\\ sub\\-exception\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "An exception inside asyncio.TaskGroup (3.11+) is wrapped in an ExceptionGroup; callers that catch the original exception type never see it.",
  "root_cause_type": "generic",
  "root_cause_zh": "asyncio.TaskGroup（3.11+）内部的异常被包装在 ExceptionGroup 中；捕获原始异常类型的调用方永远看不到它。",
  "versions": [
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The ValueError is nested inside ExceptionGroup; the outer except never matches.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Swallows the group but is bad practice; masks other failures.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Touches private state; unrelated to exception wrapping.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Catch ExceptionGroup and use except*:\n\ntry:\n    async with asyncio.TaskGroup() as tg:\n        tg.create_task(work())\nexcept* ValueError as eg:\n    handle(eg.exceptions)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Inspect sub-exceptions:\n\nexcept ExceptionGroup as eg:\n    for exc in eg.exceptions:\n        logger.error('task failed', exc_info=exc)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "For libraries that don't support except*, unwrap manually:\n\ndef unwrap(eg): return eg.exceptions[0] if len(eg.exceptions) == 1 else eg",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-25",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}