> ## Documentation Index
> Fetch the complete documentation index at: https://graph.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# map

> Runs the same steps once for each item in a list and collects the results.

## How it works

* `over` must produce a list. The body (`do`) runs once per item, with `{{item}}` and `{{index}}` available.
* `concurrency` runs that many items at once. Use it only when items don't depend on each other.
* `onError: skip` leaves failed items out of `results` and lists them in `failed`, with `failed_count`, instead of failing the plan.

## Limits

* The body can contain `agent`, `ask`, `filter`, `route` and `exit`, but not another `map` or `reduce`. Call a plan for nested iteration.
* `ask` steps in the body run one item at a time.

## Input

**concurrency** `integer`

Maximum items in flight; 1 (default) runs items one at a time.

**do** `object | object[]` *required*

**onError** `enum\<string\>`

fail (default): a failing item fails the step. skip: failed items are left out of results and listed in failed.

Available options: `fail`, `skip`

**over** `any` *required*

The list to iterate — usually a template like \{\{E0.issues}} that resolves to an array.

## Result

Later steps read these as `{{<step id>.<field>}}`.

**count** `integer`

How many items ran.

**failed** `object[]`

With `onError: skip`: the items that failed.

**failed.\[].error** `string`

Why it failed.

**failed.\[].index** `integer`

The failed item's position in the list.

**failed.\[].item** `object`

The failed item.

**failed\_count** `integer`

With `onError: skip`: how many items failed.

**results** `object[]`

Each item's result, in input order.

```yaml Plan step theme={null}
- id: E1
  tool_name: map
  input:
    over: "{{input.over}}"
    do: "{{input.do}}"
```

```json Result theme={null}
{
  "count": 2,
  "failed": [
    {
      "error": "tool error: …",
      "index": 2,
      "item": {
        "…": "…"
      }
    }
  ],
  "failed_count": 1,
  "results": [
    {
      "…": "…"
    },
    {
      "…": "…"
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.