Skip to content

fix(server-utils): Don't capture caller-handled LangGraph errors - #23594

Merged
nicohrubec merged 1 commit into
fix/langchain-instrumentation-error-capturefrom
fix/langgraph-instrumentation-error-capture
Aug 26, 2026
Merged

fix(server-utils): Don't capture caller-handled LangGraph errors#23594
nicohrubec merged 1 commit into
fix/langchain-instrumentation-error-capturefrom
fix/langgraph-instrumentation-error-capture

Conversation

@nicohrubec

@nicohrubec nicohrubec commented Aug 25, 2026

Copy link
Copy Markdown
Member

LangGraph's compiled-graph invoke wrapper and tool-node wrapper called captureException(error, { handled: false }) and then rethrew. The error rejects invoke() to the caller, so the instrumentation recorded an "unhandled crash" for an error the application handles. This is the same problem fixed for the OpenAI, Anthropic, and Google GenAI client wrappers in #23024, and for LangChain in #23593.

Related to #23023

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1d2b83c. Configure here.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.57 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.58 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.6 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.51 kB - -
@sentry/browser (incl. Tracing, Replay) 88.04 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.44 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.75 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.44 kB - -
@sentry/browser (incl. Feedback) 45.81 kB - -
@sentry/browser (incl. sendFeedback) 33.36 kB - -
@sentry/browser (incl. FeedbackAsync) 38.46 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.31 kB - -
@sentry/react (incl. Tracing) 50.79 kB - -
@sentry/vue 35.69 kB - -
@sentry/vue (incl. Tracing) 50.82 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.36 kB - -
CDN Bundle (incl. Tracing) 49.07 kB - -
CDN Bundle (incl. Logs, Metrics) 32.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.95 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 72.98 kB - -
CDN Bundle (incl. Tracing, Replay) 86.56 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.25 kB - -
CDN Bundle - uncompressed 89.97 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.69 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.26 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.38 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.36 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.12 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.79 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.81 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.48 kB - -
@sentry/nextjs (client) 53.33 kB - -
@sentry/sveltekit (client) 49.03 kB - -
@sentry/core/server 65.08 kB - -
@sentry/core/browser 52.38 kB - -
@sentry/node 121.45 kB -0.04% -40 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.19 kB - -
@sentry/node - without tracing 87.62 kB +0.03% +19 B 🔺
@sentry/aws-serverless 95.77 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 199.5 kB - -
@sentry/cloudflare (withSentry) 495.46 kB - -

View base workflow run

@nicohrubec
nicohrubec force-pushed the fix/langgraph-instrumentation-error-capture branch from 1d2b83c to 0c6e3f9 Compare August 26, 2026 08:52
LangGraph's compiled-graph invoke and tool-node wrappers called captureException
with handled: false and then rethrew. The error rejects invoke() to the caller,
so the instrumentation recorded an "unhandled crash" for an error the
application handles, the same issue fixed for the client wrappers (#23024) and
LangChain. The span is still marked failed and the error still propagates; only
the event goes away.

The integration tests masked these with .ignore('event'); those masks are removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicohrubec
nicohrubec force-pushed the fix/langgraph-instrumentation-error-capture branch from 0c6e3f9 to 9b18d3d Compare August 26, 2026 09:13
@nicohrubec
nicohrubec marked this pull request as ready for review August 26, 2026 09:24
@nicohrubec
nicohrubec requested review from a team as code owners August 26, 2026 09:24
@nicohrubec
nicohrubec requested review from JPeer264, andreiborza and isaacs and removed request for a team August 26, 2026 09:24
@nicohrubec
nicohrubec merged commit e5ff527 into develop Aug 26, 2026
201 checks passed
@nicohrubec
nicohrubec deleted the fix/langgraph-instrumentation-error-capture branch August 26, 2026 09:36
nicohrubec added a commit that referenced this pull request Aug 26, 2026
nicohrubec added a commit that referenced this pull request Aug 26, 2026
Backport of: #23594

## Differences to the original PR

- On v10 the LangGraph instrumentation lives in
`packages/core/src/tracing/langgraph/` (it moved to
`@sentry/server-utils` on v11), so the change is applied there with
v10's internal imports.
- v10's `instrumentStateGraphCompile` has an extra `catch` around
`compile()` that also captured the error. That site does not exist on
v11, but it is the same caller-handled pattern, so it is dropped too.
v10 now has zero LangGraph captures, matching develop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants