jestjs/jest · error · Error
Not enough arguments supplied for given headings: ${EXPECTED
Error message
Not enough arguments supplied for given headings:
${EXPECTED_COLOR(headings.join(' | '))}
Received:
${RECEIVED_COLOR(pretty(data))}
Missing ${RECEIVED_COLOR(missingData.toString())} ${pluralize('argument', missingData)} What it means
validateTemplateTableArguments checks that the number of interpolated `${...}` values is a multiple of the number of headings in a tagged-template table. If `data.length % headings.length !== 0`, the last row is incomplete, so jest-each reports how many arguments are missing rather than running malformed rows.
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 f49721c78e)
Solutions
- Re-count interpolations vs headings using the message's `headings` and `Missing N argument(s)` line.
- Ensure every row has exactly one `${...}` per header column.
- Escape literal `|` characters in column values or quote them, because `|` is the column delimiter.
- Re-align the template literals one-per-line so missing cells are visually obvious.
Example fix
// before
it.each`
a | b | c
${1} | ${2}
`(...);
// after
it.each`
a | b | c
${1} | ${2} | ${3}
`(...); Defensive patterns
Strategy: validation
Validate before calling
// verify row completeness for tagged-template tables
const headings = headerLine.split('|').map(s => s.trim()).filter(Boolean);
if (values.length % headings.length !== 0) {
throw new Error(`need rows of ${headings.length}, got ${values.length} values`);
} Type guard
const isCompleteRows = (headings: string[], vals: unknown[]) => headings.length > 0 && vals.length % headings.length === 0;
Prevention
- Format tagged-template tables one row per line for visual alignment.
- Escape literal pipes in cell values.
- Generate tables from arrays to avoid manual counting.
When it happens
Trigger: A tagged-template table whose header declares N columns but whose interpolated values do not fill complete rows (e.g. 2 headers but 3 interpolations).
Common situations: Editing a table and deleting one interpolation but not its header; miscounting pipes in the header (a pipe inside a column value gets parsed as a separator); copy-paste that drops a cell.
Related errors
- Error: `.each` called with an empty Tagged Template Literal
- Error: `.each` called with a Tagged Template Literal with no
- Table headings do not conform to expected format: ${EXPECTE
- `.each` must only be called with an Array or Tagged Template
- `.each` must be called with an Array or Tagged Template Lite
AI-assisted analysis of jestjs/jest@f49721c78e (2026-08-03).
Data as JSON: /data/errors/30565ae7447f0436.json.
Report an issue: GitHub.