Title: LangchainIntegration reports GraphInterrupt / GraphBubbleUp as errors via on_tool_error · Issue #6384 · getsentry/sentry-python · GitHub
Open Graph Title: LangchainIntegration reports GraphInterrupt / GraphBubbleUp as errors via on_tool_error · Issue #6384 · getsentry/sentry-python
X Title: LangchainIntegration reports GraphInterrupt / GraphBubbleUp as errors via on_tool_error · Issue #6384 · getsentry/sentry-python
Description: Environment sentry-sdk 2.59.0 (also confirmed present on master / 2.60.0) langchain-core 1.x, langgraph 0.x LangChain integration auto-enabled (not explicitly added) Problem When langgraph.types.interrupt() is called from inside a LangCh...
Open Graph Description: Environment sentry-sdk 2.59.0 (also confirmed present on master / 2.60.0) langchain-core 1.x, langgraph 0.x LangChain integration auto-enabled (not explicitly added) Problem When langgraph.types.in...
X Description: Environment sentry-sdk 2.59.0 (also confirmed present on master / 2.60.0) langchain-core 1.x, langgraph 0.x LangChain integration auto-enabled (not explicitly added) Problem When langgraph.types.in...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/6384
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LangchainIntegration reports GraphInterrupt / GraphBubbleUp as errors via on_tool_error","articleBody":"### Environment\n- `sentry-sdk` 2.59.0 (also confirmed present on `master` / 2.60.0)\n- `langchain-core` 1.x, `langgraph` 0.x\n- LangChain integration auto-enabled (not explicitly added)\n\n### Problem\nWhen `langgraph.types.interrupt()` is called from inside a LangChain `StructuredTool` — the standard pattern for exposing human-in-the-loop pauses as agent tools (e.g. `deepagents`) — it raises `GraphInterrupt`, a subclass of `langgraph.errors.GraphBubbleUp`. This is **normal control flow**, not an error: LangGraph's pregel executor catches it upstream and checkpoints the graph.\n\nHowever:\n1. `langchain_core`'s `BaseTool.arun` does not special-case `GraphBubbleUp`. It catches it in the generic `except (Exception, KeyboardInterrupt)` and calls `run_manager.on_tool_error(error)` before re-raising.\n2. Sentry's `SentryLangchainCallback.on_tool_error` -> `_handle_error` calls `sentry_sdk.capture_exception(error, ...)` with **no exception-type filtering**:\n\n```python\ndef _handle_error(self, run_id, error):\n with capture_internal_exceptions():\n if not run_id or run_id not in self.span_map:\n return\n span_data = self.span_map[run_id]\n span = span_data.span\n sentry_sdk.capture_exception(error, span.scope) # captures GraphInterrupt as an error\n ...\n```\n\nResult: every trace-sampled HITL interrupt becomes a false-positive error issue in Sentry. (Note the dedicated `LanggraphIntegration` is tracing-only and does not have this problem — only the LangChain integration does.)\n\n### Expected\n`GraphBubbleUp` exceptions (`GraphInterrupt`, etc.) are LangGraph control-flow signals and should not be captured as errors. `_handle_error` (or `on_tool_error`) should skip them:\n\n```python\ntry:\n from langgraph.errors import GraphBubbleUp\nexcept ImportError:\n GraphBubbleUp = ()\n\ndef _handle_error(self, run_id, error):\n if isinstance(error, GraphBubbleUp):\n return # langgraph control flow, not an error\n ...\n```\n\n### Workaround\nConsumers can pass `ignore_errors=[GraphBubbleUp]` to `sentry_sdk.init()`, but the integration shipping a correct default would be preferable.\n","author":{"url":"https://github.com/pyarun","@type":"Person","name":"pyarun"},"datePublished":"2026-05-21T18:52:15Z","url":"https://github.com/getsentry/sentry-python/issues/6384"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:3d20dc93-a8fa-2253-7855-82a8a79727b2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC94:10D9F8:4B7F44:6613A0:6B00CB91 |
| html-safe-nonce | 8b2643692553e666aa1526d4dd7af62ec7e5edb23bd2b55b066a20f12c1cf9a3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzk0OjEwRDlGODo0QjdGNDQ6NjYxM0EwOjZCMDBDQjkxIiwidmlzaXRvcl9pZCI6IjUzMjgxNzgwODY2NTM1MTI1OTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e4d23a3fdbd786ca0c8dd7426015f7e5673bea7da5e25ed51e3954909c98d0d6 |
| hovercard-subject-tag | issue:4497127854 |
| 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/getsentry/sentry-python/6384/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ad9505a92b7fd47d0ea6096698ea1efc8fc5d9de95987f5614687c5f695827c9/getsentry/sentry-python/issues/6384 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ad9505a92b7fd47d0ea6096698ea1efc8fc5d9de95987f5614687c5f695827c9/getsentry/sentry-python/issues/6384 |
| og:image:alt | Environment sentry-sdk 2.59.0 (also confirmed present on master / 2.60.0) langchain-core 1.x, langgraph 0.x LangChain integration auto-enabled (not explicitly added) Problem When langgraph.types.in... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pyarun |
| hostname | github.com |
| expected-hostname | github.com |
| None | 98dc00e171c204462a6f367482a0f8c3c6b5dbca99cd7390e82d2df49ce096e4 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| 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 | ef013399cf0a3c324bea644a685d7c1e0f06b5b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width