CallbackFailedException throws NullPointerException when a failed callback has no Error
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start with CallbackFailedException.buildMessage and the call sites in CallbackOperation.get() and ChildContextOperation; check how existing tests construct a failed callback operation. Add a unit test for a failed callback with no CallbackDetails.Error, and verify it throws CallbackFailedException with the message Callback failed rather than NullPointerException.
Written by the indexing model from the issue text.
Description
Description
SendDurableExecutionCallbackFailure accepts a request with no Error because the field is optional. A callback that is failed this way reaches the SDK as a CALLBACK operation with Status: FAILED and no CallbackDetails.Error.
On that operation, CallbackOperation.get() throws new CallbackFailedException(op):
The constructor passes operation.callbackDetails().error() to buildMessage. That method calls error.errorType() without a null check:
So the handler gets a NullPointerException instead of CallbackFailedException, and a catch (CallbackFailedException e) block does not catch it. ChildContextOperation builds the same exception, so the same failure can occur there:
Steps to reproduce
- Create a callback in a durable handler and call
get()on it. - Call
SendDurableExecutionCallbackFailurefor that callback ID with noErrorin the request body. - On replay,
get()throwsNullPointerExceptionfromCallbackFailedException.buildMessage.
Expected behavior
get() throws CallbackFailedException with the message "Callback failed". This matches the reference JS implementation, which falls back to new CallbackExternalError("Callback failed") when Error is absent:
Suggested fix
Handle a null ErrorObject in buildMessage:
private static String buildMessage(ErrorObject error) {
if (error == null) {
return "Callback failed";
}
var errorType = error.errorType();
var errorMessage = error.errorMessage() != null ? error.errorMessage() : "Callback failed";
if (errorType != null && !errorType.isEmpty()) {
return errorType + ": " + errorMessage;
}
return errorMessage;
}
The errorMessage fallback also covers an Error that is present but has no message. JS uses error.ErrorMessage || "Callback failed" for that case.
DurableOperationException already accepts a null ErrorObject, so no other change is needed. Add a unit test for a FAILED callback operation with no CallbackDetails.Error.
- Dominant language
- Java
- Stars
- 28
- Forks
- 13
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-durable-execution-sdk-java
-
documentation pkg:sdk
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
aws/aws-durable-execution-sdk-java#645 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws/aws-durable-execution-sdk-java#300 ·
Maintainers usually reply within 1 day
-
[Bug]: root handler instrumentation misses the canonical OTel execution contextPossibly taken A pull request linked to this issue is open or already merged. Openneeds-triage
Difficulty 5/5 Over a week Newbie friendliness 40/100
aws/aws-durable-execution-sdk-java#770 ·
Maintainers usually reply within 1 day
-
[Feature]: Propagate per-operation trace context for chained invokesPossibly taken A pull request linked to this issue is open or already merged. Openenhancement needs-triage
Difficulty 5/5 Over a week Newbie friendliness 38/100
aws/aws-durable-execution-sdk-java#764 ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 35/100
aws/aws-durable-execution-sdk-java#763 ·
Maintainers usually reply within 1 day
All issues in aws/aws-durable-execution-sdk-java
Similar issues
-
[destination-snowflake] Custom domains rejected unlike source connectionsPossibly taken @kuza55 claimed this today. Openautoteam community connectors/destination/snowflake team/use
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
component/operate kind/feature-request
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Forge coverage prompts carry text the agent cannot act onPossibly taken @graalvmbot claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
oracle/graalvm-reachability-metadata#10572 ·
Maintainers usually reply within 1 day
-
[CI] Core CI doesn't run for changes to amoro-format-lance (and amoro-web)Possibly taken @MarkAlex1234 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days