How to Retry a Lambda Task Once in Step Functions and Stop on Other Errors?
A developer is using AWS Step Functions to automate a workflow. The workflow defines each step as an AWS Lambda function task. The developer notices that runs of the Step Functions state machine fail in the GetResource task with either an IllegalArgumentException error or a TooManyRequestsException error. The developer wants the state machine to stop running when the state machine encounters an IllegalArgumentException error. The state machine needs to retry the GetResource task one additional time after 10 seconds if the state machine encounters a TooManyRequestsException error. If the second attempt fails, the developer wants the state machine to stop running. How can the developer implement the Lambda retry functionality without adding unnecessary complexity to the state machine?
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests whether you know that Step Functions' native Retry field can define error-specific retry behavior without adding Delay states or duplicating tasks, and that catchers cannot specify retry intervals or max attempts.
In AWS Step Functions, the native Retry field is the simplest way to retry a Lambda task once after 10 seconds on a TooManyRequestsException while letting IllegalArgumentException fail the state machine. Community consensus is unanimous that adding a retrier to the GetResource task is correct and avoids unnecessary complexity.
Choosing option B or A because they use a catcher with interval settings, but catchers only define the next state after an error and do not support retry timing. The native Retry field is the only place to configure IntervalSeconds and MaxAttempts for retries.
Community Discussion (4 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C correctly adds a retrier to the GetResource task. The Retry field with ErrorEquals ["TooManyRequestsException"], IntervalSeconds 10, and MaxAttempts 1 makes the state machine retry exactly one additional time after 10 seconds. Other errors, such as IllegalArgumentException, are not listed in the retrier, so they will not be retried and the state machine will stop. This is the simplest and most idiomatic Step Functions error-handling approach.Why the Other Options Are Wrong
Option A adds a Delay task and a catcher, which is unnecessary complexity; catchers do not have IntervalSeconds or MaxAttempts, and the manual delay does not integrate with retry logic. Option B incorrectly applies retry properties (interval and max attempts) to a catcher, which is invalid because catchers only specify an error to catch and a next state. Option D duplicates the GetResource task and uses a catcher to jump to the duplicate, which is a manual workaround that adds state machine bloat and is not needed when native Retry exists.Community Comment Notes
All community comments voted for C, with one commenter linking to the official AWS Step Functions error-handling documentation. The comments highlight that the Retry field is the correct place to define retry behavior and that any solution using Delay or duplicated tasks is over-engineered. The linked documentation confirms that the Retry field supports Task states and includes parameters such as ErrorEquals, IntervalSeconds, and MaxAttempts.Official Reference
Exam Strategy
When you see a Step Functions error-handling question, first look for a native Retry field option with ErrorEquals, IntervalSeconds, and MaxAttempts. Remember that catchers cannot contain retry timing settings, so if an option puts interval/max attempts on a catcher, it is automatically wrong.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →