# `type.batch_row_invalid`

A file helper's rows can't be read as the type its `as:` names or from where its `items_at:` says, its `max_unpacked_size:` isn't a size, or its rows can't be written as the row its `each:` gives.

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

A file helper reads each row as the `Input` its `as:` names, and writes
each as the `Output` its `each:` gives. A CSV or TSV row
holds one value a cell, so a row type holding a list, a map, an object
or a standard type with no one text form is refused, pointing at JSON
Lines, whose rows hold any JSON value; so is a row type that isn't an
`Input` (or, written, an `Output`), or two fields reading or writing one
column. The same rule refuses `json.read`'s `items_at:`
when it isn't member names written out between dots (`"data.items"`),
and a reader's `max_unpacked_size:` when it isn't a size (`200mb`):







```jadpo
use bakery/types { OrderCode }

/// One order a sheet lists, with its lines.
type OrderRow = Input {
    reference: OrderCode
    lines: List<OrderCode>
}
```


```jadpo
use bakery/entities { OrderSheet, OrderSheetNotFound }
use bakery/types { OrderRow }
use bakery/actions { take_order }

/// Starts taking the orders a kept sheet lists.
action read_orders(sheet_id: OrderSheet.id) fails OrderSheetNotFound -> BatchRun {
    var order_sheet: OrderSheet = attempt OrderSheet.get(sheet_id)
    return csv.read(order_sheet.sheet, as: OrderRow, each: order_entry -> take_order(order_entry))
}
```

```text
error: `csv.read` can't read its rows as `OrderRow`
 --> domains/bakery/actions/read_orders.jadpo:8:44
  |
8 |     return csv.read(order_sheet.sheet, as: OrderRow, each: order_entry -> take_order(order_entry))
  |                                            ^^^^^^^^ `OrderRow.lines` holds a list
  reason: A CSV row holds one value a cell, and `OrderRow.lines` holds a list; a JSON Lines row holds lists and objects, each line one JSON value.
  next: Read the file with `json_lines.read`, or give `lines` a type one cell holds (agent)
  rule: type.batch_row_invalid
  help: https://jadpo.dev/docs/errors/type.batch_row_invalid

check failed: 1 error, 9 files
```
