# States.ExecutionFailed：状态机的执行超过了最大执行历史记录大小 25000 条

- **ID:** `aws/stepfunctions-state-machine-execution-limit-exceeded`
- **领域:** aws
- **类别:** resource_error
- **错误码:** `States.ExecutionFailed`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Step Functions 2024-08-01 | active | — | — |
| AWS SDK v2 | active | — | — |
| Lambda 2023-11-01 | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **** — The 25,000 history entry limit is a hard limit that cannot be increased by AWS support. (95% 失败率)
- **** — 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. (50% 失败率)
- **** — The limit is on history entries, not time; increasing timeout does not reduce history entries. (80% 失败率)
