# validateAddPiecesBatch

> **validateAddPiecesBatch**(`pieceCount`): `void`

Defined in: [packages/synapse-core/src/sp/add-pieces.ts:118](https://github.com/FilOzone/synapse-sdk/blob/bcb6af16ba9b8406998ce3d173cf6b9e2998b815/packages/synapse-core/src/sp/add-pieces.ts#L118)

Validate the piece count for an addPieces (or createDataSetAndAddPieces) batch,
failing early instead of reverting on-chain.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `pieceCount` | `number` | Number of pieces in the batch |

## Returns

`void`

## Throws

AtLeastOnePieceRequiredError when not a positive integer

## Throws

TooManyPiecesError when above [SIZE\_CONSTANTS.MAX\_ADD\_PIECES\_BATCH\_SIZE](/reference/filoz/synapse-core/utils/variables/size_constants/#max_add_pieces_batch_size)