jestjs/jest · error · Error
Not enough arguments supplied for given headings
Error message
Not enough arguments supplied for given headings:
${headings.join(' | ')}
Received:
${pretty(data)}
Missing ${missingData.toString()} ${pluralize('argument', missingData)} What it means
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.
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.
Example fix
// before — 3 headings, 2 values
test.each`a | b | c
${1} | ${2}`('test', ({a,b,c}) => {});
// after — 3 headings, 3 values
test.each`a | b | c
${1} | ${2} | ${3}`('test', ({a,b,c}) => {}); Defensive patterns
Strategy: validation
Validate before calling
// Validate heading count vs data count for tagged template .each
function validateHeadingsDataAlignment(headings, data) {
if (data.length % headings.length !== 0) {
const missing = headings.length - (data.length % headings.length);
throw new Error(`Missing ${missing} value(s) for ${headings.length} headings`);
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Error: `.each` called with a Tagged Template Literal with…
- Error: `.each` called with an empty Tagged Template Literal…
- Table headings do not conform to expected format: heading1…
- `.each` must be called with an Array or Tagged Template…
- `.each` must only be called with an Array or Tagged…
AI-assisted analysis of jestjs/jest@8e6d128e4a (2026-08-10).
Data as JSON: /api/errors/bb3b584d622fbfd3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/jest-each/src/validation.ts:61
'Error: `.each` called with an empty Array of table data.\n',
);
}
};
const isTaggedTemplateLiteral = (array: any) => array.raw !== undefined;
const isEmptyTable = (table: Array<unknown>) => table.length === 0;
const isEmptyString = (str: string | unknown) =>
typeof str === 'string' && str.trim() === '';
export const validateTemplateTableArguments = (
headings: Array<string>,
data: TemplateData,
): void => {
const incompleteData = data.length % headings.length;
const missingData = headings.length - incompleteData;
if (incompleteData > 0) {
throw new Error(
`Not enough arguments supplied for given headings:\n${EXPECTED_COLOR(
headings.join(' | '),
)}\n\n` +
`Received:\n${RECEIVED_COLOR(pretty(data))}\n\n` +
`Missing ${RECEIVED_COLOR(missingData.toString())} ${pluralize(
'argument',
missingData,
)}`,
);
}
};
const pluralize = (word: string, count: number) =>
word + (count === 1 ? '' : 's');
const START_OF_LINE = '^';
const NEWLINE = '\\n';
const HEADING = '\\s*[^\\s]+\\s*';View on GitHub (pinned to 8e6d128e4a)