## TL;DR
Stop requesting new reports in a loop, because each fresh request restarts the generation clock. Request the report once, then poll its state with the get operation at a calm interval until it reports complete, and only then download it. Very large accounts take minutes, not seconds, and console downloads can time out while the API path succeeds, so switch the evidence pull to the CLI or an SDK job that writes the report straight to storage the review can read.

```text
AWS IAM credential report generation timed out: how to fix report failed error
```

## Use this when
- GenerateCredentialReport never seems to finish or the console download spins.
- Automation errors with a timeout while fetching the credential report.
- The report used in the review is stale because fresh pulls keep failing.

## Not for this skill when
- The report generates but shows wrong data. That is an interpretation problem on a completed report.
- You need sign-in history beyond the report. Use CloudTrail or sign-in logs instead.

## Steps
1. Request report generation once through the CLI and record the returned state and the time, resisting any second generation request while this one runs. Verify: one generation request exists with a recorded start time.
2. Poll the report state at intervals of roughly half a minute and note how the state changes, treating a still running state as progress rather than failure. Verify: state transitions are observed up to complete or a genuine error state.
3. If the console path times out but the API state reaches complete, download the report content through the CLI and save it directly to the evidence location as a dated file. Verify: a complete report file exists with todays date in its name or metadata.
4. Check the report row count against the IAM user count in the account so a truncated download is not mistaken for a short user list. Verify: report rows and user count reconcile or the gap is explained.
5. Fix the automation to request once and poll state with backoff instead of timing out and regenerating, and set its overall timeout above the observed generation time for this account. Verify: the job succeeds on its next scheduled run without manual help.
6. Where several accounts are reviewed, stagger their report jobs rather than firing all generations at once from one runner, and keep per account outputs separate. Verify: each account produces its own dated report file.
7. Attach the fresh report and its generation timestamp to the review, replacing the stale copy, and note the working method in the runbook. Verify: the review evidence holds a current report and the runbook names the method.

## Why it happens
Credential report generation is an account wide job that walks every user and key, so big accounts take real time. Most timeout failures are client side impatience: a console session, a script timeout or a retry loop that keeps discarding nearly finished work by requesting generation again. The state based flow, request once and poll, matches how the service actually works, and writing the result straight to a file avoids the browser download step where large reports most often die.

## Variants and edge cases

### IAM credential report generation stuck STARTED state
The state phrasing. A long STARTED state in a huge account is usually genuine work; poll longer before escalating.

### credential report download fails in console large account
The console phrasing. Switch the same report pull to the CLI rather than shrinking the account or the report.

### automation timeout fetching credential report for audit
The automation phrasing. Poll state with backoff and raise the job timeout above the measured generation time.

Edge cases to check before closing the review cycle:
- Only one report generation runs per account at a time. Coordinate reviewers so they do not restart each others jobs.
- The report reflects data at generation time. A key created minutes later will not appear until the next report.
- In organizations, generate per account. There is no single organization wide credential report.

Compatibility: AWS IAM credential report APIs GenerateCredentialReport and GetCredentialReport, AWS CLI v2, large multi-account review setups.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_NhDESIO9Uv3nUY50ZDrv3A
