# validateAddPiecesBatch

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

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

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)