{"record":{"id":"963b05410b3aa3d0","repo":"vercel/ai","slug":"chunksize-must-be-greater-than-0","errorCode":null,"errorMessage":"chunkSize must be greater than 0","messagePattern":"chunkSize must be greater than 0","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/ai/src/util/split-array.ts","lineNumber":11,"sourceCode":"/**\n * Splits an array into chunks of a specified size.\n *\n * @template T - The type of elements in the array.\n * @param {T[]} array - The array to split.\n * @param {number} chunkSize - The size of each chunk.\n * @returns {T[][]} - A new array containing the chunks.\n */\nexport function splitArray<T>(array: T[], chunkSize: number): T[][] {\n  if (chunkSize <= 0) {\n    throw new Error('chunkSize must be greater than 0');\n  }\n\n  const result = [];\n  for (let i = 0; i < array.length; i += chunkSize) {\n    result.push(array.slice(i, i + chunkSize));\n  }\n\n  return result;\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/util/split-array.ts#L1-L21","documentation":"Error \"chunkSize must be greater than 0\" thrown in vercel/ai.","triggerScenarios":"Thrown at packages/ai/src/util/split-array.ts:11 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}