Repository navigation
Return null from Java SDK getVariable for missing Variables - #75920
Open
aaron-y-chen wants to merge 2 commits into
Open
aaron-y-chen wants to merge 2 commits into
aaron-y-chen wants to merge 2 commits into
Conversation
aaron-y-chen
marked this pull request as ready for review
October 29, 2026 02:29
aaron-y-chen
requested review from
amoghrajesh,
ashb,
bugraoz93,
gopidesupavan,
jason810496,
jscheffl,
potiuk and
uranusjr
as code owners
October 29, 2026 02:29
uranusjr
reviewed
Oct 29, 2026
uranusjr
reviewed
Oct 29, 2026
Contributor
Author
|
unrelated CI failure on |
uranusjr
approved these changes
Oct 30, 2026
aaron-y-chen
force-pushed
the
java-sdk-variable-not-found-null
branch
from
October 30, 2026 16:53
39fe516 to
84fd69a
Compare
This branch has not been deployed
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.
Summary
Client.getVariable(key)in the Java SDK is documented (KDoc andjava.rst) to returnnullwhen the Variable does not exist, but it threwApiErrorinstead. A task reading an optional Variable failed rather than falling back to a default, and sinceApiErrorcarries no error type, callers could only tell "missing" apart from real failures by parsing the message.The supervisor reports a missing Variable as
ErrorResponse(VARIABLE_NOT_FOUND).getVariablenow handles it withcommunicateOrNullIf, the same waygetTaskStateStorehandlesTASK_STORE_NOT_FOUND:VARIABLE_NOT_FOUNDreturnsnull, and any other error still raisesApiError.Behavior change
java-sdk1.0.0-beta1 shipped with the throwing behavior. Code that catchesApiErrorto detect a missing Variable now getsnullinstead.Testing
CommsTest:VARIABLE_NOT_FOUNDreturnsnull; any other error response still raisesApiError.WriteAndDeleteVariablereads the Variable back after deleting it and fails unless the result isnull. Verified locally: the Dag run fails without the fix (ApiError: [VARIABLE_NOT_FOUND]) and succeeds with it.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines