vercel/ai · error · Error
chunkSize must be greater than 0
Error message
chunkSize must be greater than 0
What it means
Error "chunkSize must be greater than 0" thrown in vercel/ai.
Source
Thrown at packages/ai/src/util/split-array.ts:11
/**
* Splits an array into chunks of a specified size.
*
* @template T - The type of elements in the array.
* @param {T[]} array - The array to split.
* @param {number} chunkSize - The size of each chunk.
* @returns {T[][]} - A new array containing the chunks.
*/
export function splitArray<T>(array: T[], chunkSize: number): T[][] {
if (chunkSize <= 0) {
throw new Error('chunkSize must be greater than 0');
}
const result = [];
for (let i = 0; i < array.length; i += chunkSize) {
result.push(array.slice(i, i + chunkSize));
}
return result;
}
View on GitHub (pinned to 69428b1f8b)
When it happens
Trigger: Thrown at packages/ai/src/util/split-array.ts:11 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/963b05410b3aa3d0.
Report an issue: GitHub.