# `type.batch_each_invalid`

A batch's `each:` or `finished:` is not one call of an action in its domain, or a write's `each:` no inline function giving the row.

Area 12, [Jobs and events](../topics/jobs-and-events.md); not declinable; the next step is usually the agent's.

`each:` and `finished:` are one call of an action in the same domain,
whose arguments are the item, a field inside it, or a value saved with
the run. (A file helper's write's `each:` is one inline function giving
the item's row instead, refused when it is anything else.)
One that works something out of the item is refused:


```jadpo
action mark_code(code: ShelfCode) -> Unit {
    assert code == code
}

action sweep_shelf(page: ItemPage) -> BatchRun {
    return batches.each(from: items(page), each: item -> mark_code(ShelfCode(item.code)))
}
```

```text
error: `batches.each`'s `each:` isn't one call of an action
 --> main.jadpo:6:68
  |
6 |     return batches.each(from: items(page), each: item -> mark_code(ShelfCode(item.code)))
  |                                                                    ^^^^^^^^^^^^^^^^^^^^ the item and more
  reason: An argument reading `item` is `item` itself or a field inside it, which the run reads from each item; one that reads nothing of it is worked out now and saved with the run. Work the rest out in the action it calls.
  next: Write `each: item -> <action>(...)`, calling an action in this domain (agent)
  rule: type.batch_each_invalid
  help: https://jadpo.dev/docs/errors/type.batch_each_invalid

check failed: 1 error, 2 files
```
