Title: ExceptionGroup wrapping obscures real errors from task groups · Issue #2114 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: ExceptionGroup wrapping obscures real errors from task groups · Issue #2114 · modelcontextprotocol/python-sdk
X Title: ExceptionGroup wrapping obscures real errors from task groups · Issue #2114 · modelcontextprotocol/python-sdk
Description: Summary When SDK internal anyio task group tasks fail, the real error is wrapped in a BaseExceptionGroup alongside Cancelled exceptions from cancelled sibling tasks. This makes error classification extremely difficult for callers — they ...
Open Graph Description: Summary When SDK internal anyio task group tasks fail, the real error is wrapped in a BaseExceptionGroup alongside Cancelled exceptions from cancelled sibling tasks. This makes error classification...
X Description: Summary When SDK internal anyio task group tasks fail, the real error is wrapped in a BaseExceptionGroup alongside Cancelled exceptions from cancelled sibling tasks. This makes error classification...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/2114
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ExceptionGroup wrapping obscures real errors from task groups","articleBody":"## Summary\n\nWhen SDK internal anyio task group tasks fail, the real error is wrapped in a `BaseExceptionGroup` alongside `Cancelled` exceptions from cancelled sibling tasks. This makes error classification extremely difficult for callers — they cannot reliably determine the root cause of a failure.\n\nThere are 16 `create_task_group()` usages across the SDK with no `except*` syntax or ExceptionGroup unwrapping anywhere.\n\n## Expected Behavior\n\n- Callers should receive the original exception, not an ExceptionGroup wrapping it alongside cancellation noise\n- When a task group has one real failure and N cancelled siblings, only the real failure should propagate\n\n## Current Behavior\n\n- A single connection failure produces a `BaseExceptionGroup` containing the real error plus multiple `Cancelled` exceptions\n- Callers must manually unwrap exception groups to find the root cause\n- This affects ~80+ call sites across the SDK where task groups are used\n\n## Affected Code\n\n- `src/mcp/shared/session.py` (session task groups)\n- `src/mcp/client/streamable_http.py` (transport task groups)\n- All other `create_task_group()` sites\n\n## Related\n\n- #1742 — broader typed error classes design\n- #1830 — CancelledError indistinguishable from external cancellation (closed but related)\n\n---\n\n\u003csub\u003e[AI Disclaimer](https://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d)\u003c/sub\u003e","author":{"url":"https://github.com/maxisbey","@type":"Person","name":"maxisbey"},"datePublished":"2026-02-19T21:52:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/2114/python-sdk/issues/2114"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d04df6ab-e46c-37b0-bf06-3aa0c4276b0b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE3C:2100CB:A26F4:D76D4:6A5B13D7 |
| html-safe-nonce | 96f0480ca669f9d1643da1268d692b916821a4ec79a55d5eb2fae531482dbc94 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTNDOjIxMDBDQjpBMjZGNDpENzZENDo2QTVCMTNENyIsInZpc2l0b3JfaWQiOiI1NTMzNDg4ODE5MTU1NDQwNTk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e78bc8cd758dbbee55dcd8de0901d84f6bc5154f79c6c497056129b1b0e53e72 |
| hovercard-subject-tag | issue:3965307789 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/2114/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5418d210a600f92f025aed4d63d8db1c28dfda59f60457a5c66f423d48a53bd4/modelcontextprotocol/python-sdk/issues/2114 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5418d210a600f92f025aed4d63d8db1c28dfda59f60457a5c66f423d48a53bd4/modelcontextprotocol/python-sdk/issues/2114 |
| og:image:alt | Summary When SDK internal anyio task group tasks fail, the real error is wrapped in a BaseExceptionGroup alongside Cancelled exceptions from cancelled sibling tasks. This makes error classification... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxisbey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width