Repository navigation
fix(sdk): don't NPE in CallbackFailedException when the callback has no error - #774
Merged
zhongkechen merged 2 commits intoOct 5, 2026
Merged
Conversation
…no error SendDurableExecutionCallbackFailure accepts a request without an Error, so a FAILED callback operation can arrive with no CallbackDetails.Error. buildMessage dereferenced the error unconditionally, so get() threw NullPointerException instead of CallbackFailedException. Fall back to "Callback failed", matching the JS SDK. Fixes aws#773
Pitchfork-and-Torch
deployed
to
ai-pr-review-runtime
October 5, 2026 16:59 — with
GitHub Actions
Active
zhongkechen
approved these changes
Oct 5, 2026
zhongkechen
left a comment
Contributor
There was a problem hiding this comment.
Thanks for fixing this and adding a regression test! The null guard correctly handles a missing callback error while preserving the existing behavior when an error is present. I checked both callback failure paths and ran the 27 related exception, callback-operation, and child-context tests locally; all passed.
Parallel can finish after the second failure while a successful branch is still running. That branch may skip its terminal checkpoint, so a fixed total history size depends on scheduling. Assert the failure threshold, branch outcomes, and the parallel operation's own checkpoint events instead. Verify that replay preserves both the result and history in FLAT and NESTED modes. Validation: Java 25 SDK, testing utilities, and local integration suites (1647 tests); Java 17 parallel and child-context tests; Spotless check. A controlled late-branch probe also verified stable results and history on replay.
3 of 7 tasks
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.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue Link, if available
Fixes #773
Description
SendDurableExecutionCallbackFailureaccepts a request with noError, so aCALLBACKoperation can come backFAILEDwith noCallbackDetails.Error.CallbackFailedException.buildMessagecallederror.errorType()without a null check.CallbackOperation.get()(andChildContextOperation.handleWaitForCallbackFailure) then threwNullPointerExceptioninstead ofCallbackFailedException, and acatch (CallbackFailedException e)block never saw it.The fix is a null guard in
buildMessagethat falls back to"Callback failed", the same message the JS SDK uses.getErrorObject()staysnull, whichDurableOperationExceptionalready allows. Both call sites build the exception through this constructor, so they are both covered.Demo/Screenshots
N/A
Checklist
Testing
Unit Tests
Yes.
CallbackExceptionTest.testCallbackFailedExceptionWithoutErrorbuilds a callback operation with no error and checks the callback id, the operation, anullerror object, and the message"Callback failed".NullPointerException: Cannot invoke "ErrorObject.errorType()" because "error" is nullatCallbackFailedException.buildMessage.mvn -pl sdk -am testpasses, 1203 tests, 0 failures.mvn spotless:checkis clean.Integration Tests
No. This is an isolated fix inside the exception's constructor, and the unit test covers it.
Examples
N/A