{"record":{"id":"0766592f41853802","repo":"heygen-com/hyperframes","slug":"source-contains-zero-rows","errorCode":null,"errorMessage":"${source} contains zero rows.","messagePattern":"(.+?) contains zero rows\\.","errorType":"validation","errorClass":"BatchRenderInputError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/batchRender.ts","lineNumber":110,"sourceCode":"  try {\n    return JSON.parse(raw);\n  } catch (error: unknown) {\n    throw new BatchRenderInputError(\"Invalid JSON in --batch\", `${source}: ${errorMessage(error)}`);\n  }\n}\n\nexport function parseBatchRows(raw: string, source: string): Record<string, unknown>[] {\n  const parsed = parseJson(raw, source);\n  const rows = Array.isArray(parsed) ? parsed : isRecord(parsed) ? parsed.rows : undefined;\n\n  if (!Array.isArray(rows)) {\n    throw new BatchRenderInputError(\n      \"Invalid batch payload\",\n      '--batch must be a JSON array of objects, or an object with a \"rows\" array.',\n    );\n  }\n  if (rows.length === 0) {\n    throw new BatchRenderInputError(\"Empty batch\", `${source} contains zero rows.`);\n  }\n\n  return rows.map((row, index) => {\n    if (!isRecord(row)) {\n      throw new BatchRenderInputError(\n        \"Invalid batch row\",\n        `Row ${index} must be a JSON object of variable values.`,\n      );\n    }\n    return row;\n  });\n}\n\nfunction placeholderValue(row: Record<string, unknown>, key: string, index: number): string {\n  if (key === \"index\") return String(index);\n  if (!Object.hasOwn(row, key)) {\n    throw new BatchRenderInputError(\n      \"Invalid output template\",","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/batchRender.ts#L92-L128","documentation":"BatchRenderInputError with title 'Empty batch', thrown by parseBatchRows when the rows array exists but has length 0. Batch rendering zero rows would produce no output and is almost certainly a mistake, so the parser rejects it eagerly after the shape check passes.","triggerScenarios":"Passing `--batch '[]'` or `{\"rows\":[]}`; a generated batch file whose templating produced zero rows; a filter upstream that removed every row.","commonSituations":"A script generates the batch from a spreadsheet/DB query that returned no rows; the user passed an empty array as a placeholder; conditional logic dropped all elements.","solutions":["Confirm the data source actually has rows; regenerate the batch file.","If you intentionally want zero output, do not invoke render at all.","Add an upstream assertion that rows.length > 0 before calling render."],"exampleFix":"# before: empty array\nhyperframes render --batch '[]'\n\n# after: at least one row\nhyperframes render --batch '[{\"out\":\"a.mp4\"}]'","handlingStrategy":"validation","validationCode":"function assertNonEmptyRows(rows: unknown[]) {\n  if (rows.length === 0) throw new Error('batch has zero rows; nothing to render');\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseBatchRows(raw, source);\n} catch (err) {\n  if (err instanceof BatchRenderInputError && err.title === 'Empty batch') {\n    // regenerate the batch from the data source\n  }\n}","preventionTips":["Assert rows.length > 0 upstream before invoking render.","Inspect the data source (query/spreadsheet) that produced the batch.","Skip the render command entirely when there is no work to do."],"tags":["cli","validation","batch"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}