{"record":{"id":"bb3b584d622fbfd3","repo":"jestjs/jest","slug":"not-enough-arguments-supplied-for-given-headings","errorCode":null,"errorMessage":"Not enough arguments supplied for given headings:\n${headings.join(' | ')}\n\nReceived:\n${pretty(data)}\n\nMissing ${missingData.toString()} ${pluralize('argument', missingData)}","messagePattern":"Not enough arguments supplied for given headings:\n(.+?)\n\nReceived:\n(.+?)\n\nMissing (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/jest-each/src/validation.ts","lineNumber":61,"sourceCode":"      'Error: `.each` called with an empty Array of table data.\\n',\n    );\n  }\n};\n\nconst isTaggedTemplateLiteral = (array: any) => array.raw !== undefined;\nconst isEmptyTable = (table: Array<unknown>) => table.length === 0;\nconst isEmptyString = (str: string | unknown) =>\n  typeof str === 'string' && str.trim() === '';\n\nexport const validateTemplateTableArguments = (\n  headings: Array<string>,\n  data: TemplateData,\n): void => {\n  const incompleteData = data.length % headings.length;\n  const missingData = headings.length - incompleteData;\n\n  if (incompleteData > 0) {\n    throw new Error(\n      `Not enough arguments supplied for given headings:\\n${EXPECTED_COLOR(\n        headings.join(' | '),\n      )}\\n\\n` +\n        `Received:\\n${RECEIVED_COLOR(pretty(data))}\\n\\n` +\n        `Missing ${RECEIVED_COLOR(missingData.toString())} ${pluralize(\n          'argument',\n          missingData,\n        )}`,\n    );\n  }\n};\n\nconst pluralize = (word: string, count: number) =>\n  word + (count === 1 ? '' : 's');\n\nconst START_OF_LINE = '^';\nconst NEWLINE = '\\\\n';\nconst HEADING = '\\\\s*[^\\\\s]+\\\\s*';","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/jestjs/jest/blob/8e6d128e4a278059ecddecaa97400b04c8ae5fd9/packages/jest-each/src/validation.ts#L43-L79","documentation":"Thrown by `validateTemplateTableArguments` when using tagged template `.each` syntax and the number of interpolated data values is not evenly divisible by the number of headings. Each data row must fill all heading columns, so a partial row triggers this error listing the missing count.","triggerScenarios":"Writing `` test.each`a | b | c\\n ${1} | ${2}` `` — three headings but only two interpolated values. The modulo check `data.length % headings.length` is non-zero, and the missing count is computed.","commonSituations":"Adding a new column heading but forgetting to update data rows. Misaligned pipe characters in the template header. Copy-pasting rows and missing a value.","solutions":["Count the headings and ensure each data row provides exactly that many interpolated values.","Re-read the error — it prints the headings and the received data, so compare the counts visually.","Add the missing interpolated value(s) to complete the partial row."],"exampleFix":"// before — 3 headings, 2 values\ntest.each`a | b | c\n  ${1} | ${2}`('test', ({a,b,c}) => {});\n\n// after — 3 headings, 3 values\ntest.each`a | b | c\n  ${1} | ${2} | ${3}`('test', ({a,b,c}) => {});","handlingStrategy":"validation","validationCode":"// Validate heading count vs data count for tagged template .each\nfunction validateHeadingsDataAlignment(headings, data) {\n  if (data.length % headings.length !== 0) {\n    const missing = headings.length - (data.length % headings.length);\n    throw new Error(`Missing ${missing} value(s) for ${headings.length} headings`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Count headings and data values manually before running.","Keep headings and data rows aligned visually in the template.","Consider using array-of-objects syntax for complex multi-column tables."],"tags":["jest-each","parameterized-tests","validation","tagged-template","data-mismatch"],"backgroundTag":null,"analyzedSha":"8e6d128e4a278059ecddecaa97400b04c8ae5fd9","analyzedAt":"2026-08-10T18:11:27.960Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}