Repository navigation
Conversation
nancodex
force-pushed
the
fix/anthropic-error-cause-propagation
branch
2 times, most recently
from
November 25, 2026 06:06
5072017 to
f6f0726
Compare
When an Anthropic API call fails, the error reported to the user contains only a static string with no diagnostic information. Any API failure — timeout, auth error, invalid model, network issue — is reported as the same opaque string. AnthropicChatModelConnection.chat() wraps all exceptions in RuntimeException with the cause attached, but ChatModelInvoker.errorText() extracts only getMessage(), discarding the cause. This change: - Includes the cause message in the wrapper RuntimeException - Appends the cause chain in ChatModelInvoker.errorText() when present Generated-by: Claude Code (Claude Sonnet 4)
nancodex
force-pushed
the
fix/anthropic-error-cause-propagation
branch
from
November 25, 2026 08:13
f6f0726 to
b65116d
Compare
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.
Linked issue: None
Purpose of change
When an Anthropic API call fails, the error reported to the user contains only a static string (
"Failed to call Anthropic messages API.") with no diagnostic information. Any API failure — timeout, auth error, invalid model, network issue — is reported as the same opaque string, making diagnosis impossible without reading the full TaskManager stack trace.Root cause:
AnthropicChatModelConnection.chat()wraps all exceptions inRuntimeException("Failed to call Anthropic messages API.", e)— the causeeis attached but not surfaced.ChatModelInvoker.errorText()extracts onlygetMessage(), discarding the cause entirely.Behavioral Semantics
The change is backward compatible:
"Failed to call Anthropic messages API."is preserved (existingtestBuildFailureIsWrappedstill passes)."Cause: "inAnthropicChatModelConnection.chat().ChatModelInvoker.errorText()appends[caused by: <cause>]when the exception has a non-null cause whose message is not already contained in the wrapper message.InvocationFailureorRoutingFailure— their messages are still returned as-is.Tests
testChatExceptionIncludesCauseMessageverifies the wrapped RuntimeException includes"Cause:"and the root cause message.testBuildFailureIsWrappedcontinues to pass (original message substring preserved).AnthropicChatModelConnectionTesttests pass.ChatModelInvokerTesttests pass.API
No public API changes. The
errorText()method inChatModelInvokerispublic staticbut only the error string format changes (appends cause info), not the method signature.Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Sonnet 4)