States.ExecutionFailed aws resource_error ai_generated true

States.ExecutionFailed: The execution of state machine exceeded the maximum execution history size of 25000 entries

ID: aws/stepfunctions-state-machine-execution-limit-exceeded

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
1Evidence
2024-04-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Step Functions 2024-08-01 active
AWS SDK v2 active
Lambda 2023-11-01 active

Root Cause

Step Functions state machine execution has generated more than 25,000 history entries (e.g., due to long-running loops or large input/output payloads), which exceeds the service limit.

generic

中文

Step Functions 状态机执行生成了超过 25,000 条历史记录(例如,由于长时间运行的循环或大型输入/输出负载),超出了服务限制。

Official Documentation

https://docs.aws.amazon.com/step-functions/latest/dg/limits.html

Workarounds

  1. 80% success Refactor the state machine to use a nested workflow or a callback pattern to break long-running executions into smaller chunks. Example: Use a Map state with a max concurrency to process items in parallel, reducing the number of steps.
    Refactor the state machine to use a nested workflow or a callback pattern to break long-running executions into smaller chunks. Example: Use a Map state with a max concurrency to process items in parallel, reducing the number of steps.
  2. 75% success Reduce input/output payload sizes by filtering or truncating data between states. Use a Pass state with ResultPath to trim unnecessary fields.
    Reduce input/output payload sizes by filtering or truncating data between states. Use a Pass state with ResultPath to trim unnecessary fields.
  3. 85% success Implement a loop with a counter and a maximum iteration limit to prevent infinite loops from generating too many history entries.
    Implement a loop with a counter and a maximum iteration limit to prevent infinite loops from generating too many history entries.

中文步骤

  1. Refactor the state machine to use a nested workflow or a callback pattern to break long-running executions into smaller chunks. Example: Use a Map state with a max concurrency to process items in parallel, reducing the number of steps.
  2. Reduce input/output payload sizes by filtering or truncating data between states. Use a Pass state with ResultPath to trim unnecessary fields.
  3. Implement a loop with a counter and a maximum iteration limit to prevent infinite loops from generating too many history entries.

Dead Ends

Common approaches that don't work:

  1. 95% fail

    The 25,000 history entry limit is a hard limit that cannot be increased by AWS support.

  2. 50% fail

    This may reduce history entries but can make the state machine less maintainable and might not solve the root cause if loops are the issue.

  3. 80% fail

    The limit is on history entries, not time; increasing timeout does not reduce history entries.