Repository navigation
feat(eager): add FATAL error when a node is deferred due to an exception - #1357
Merged
jasmith-hs merged 1 commit intoOct 29, 2026
Merged
Conversation
In eager execution mode, a DeferredValueException reaching ExpressionNode or TagNode means the node could not be handled and is output verbatim. Surface this as a FATAL interpreter error so callers know the output is incomplete. Default execution mode is unchanged, since deferring nodes there is the expected way of preserving deferred values. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mnobile-hs
approved these changes
Oct 29, 2026
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.
Description
In eager execution mode, when a
DeferredValueExceptionreachesExpressionNodeorTagNode, the node falls back tohandleDeferredNodeand its original image is written to the output. Eager execution normally handles deferral through deferred tokens, so getting to this catch means the node couldn't be handled (for example: output too big, too many deferred tokens, or a modification of a temporary import alias). Until now this happened silently: rendering looked successful even though the output was incomplete.This PR adds a FATAL
TemplateErrorfrom the exception, with the node's line number and start position, so callers can detect that the output is incomplete.Default execution mode is not changed. There, deferring a node is the expected way of preserving deferred values for a later render, and adding a FATAL error would make
Jinjava.render()throw for every template that uses deferred values.BRAVE
Backwards Compatibility
Jinjava.render()this means aFatalTemplateErrorsException, and the configuredErrorHandlingStrategyapplies.Rollout and Rollback Plan
Automated Testing
EagerAstDotTest: checks that a deferredExpressionNodereports a FATAL error.EagerTest.itFailsOnModificationInAliasedMacro: checks for the FATAL "Cannot modify temporary import alias" error.EagerSetTagTest/EagerDoTagTestitLimitsLength: check for the new FATALEXCEPTIONerror alongsideOUTPUT_TOO_BIG.DeferredTeststill passes, confirming default mode is unaffected.Verification
mvn clean verifypasses (2238 tests).Expect Dependencies to Fail
REVIEWERS: Please review both the code changes and the answers above, and validate that they match the expectations for BRAVE
This description was authored by Claude Code.
🤖 Generated with Claude Code