fix(server-utils): Don't capture caller-handled LangChain errors - #23593
Draft
nicohrubec wants to merge 1 commit into
Draft
fix(server-utils): Don't capture caller-handled LangChain errors#23593nicohrubec wants to merge 1 commit into
nicohrubec wants to merge 1 commit into
Conversation
LangChain's callback error handlers (handleLLMError, handleChainError, handleToolError) and the embeddings wrapper called captureException with handled: false. These errors reject invoke()/embedQuery() to the caller, so the instrumentation recorded an "unhandled crash" for an error the application handles, the same issue fixed for the OpenAI, Anthropic and Google GenAI client wrappers in #23024. 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 so the tests no longer hide instrumentation-level captures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LangChain's callback error handlers (
handleLLMError,handleChainError,handleToolError) and the embeddings wrapper calledcaptureException(error, { handled: false }). These errors rejectinvoke()/embedQuery()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.The span is still marked
internal_errorand the error still propagates to the caller, so only the event goes away, leaving thehandleddecision to the application boundary.The integration tests masked these captures with
.ignore('event'); those masks are removed so the tests no longer hide instrumentation-level captures.LangGraph has the same problem and follows in a stacked PR on top of this one.
Related to #23023