A reduction without an initial value fails when no element can seed its accumulator. Choose an initial accumulator that matches the operation, or treat empty input as a deliberate separate case.
Reproduce the behavior safely
Run this self-contained fixture in an empty temporary directory, separate from your project. Shell examples create only named fixture files there. JavaScript examples use local values and send no network requests.
const assert = require('node:assert/strict');
const selected = [2, 4].filter(value => value > 9);
assert.throws(() => selected.reduce((a, b) => a + b), TypeError);
assert.equal(selected.reduce((sum, value) => sum + value, 0), 0);
const rows = [{amount: 4}, {amount: 6}];
const total = rows.reduce((sum, row) => sum + row.amount, 0);
assert.equal(total, 10);
console.log(JSON.stringify({emptyTotal: 0, total}));Observed local output
{"emptyTotal":0,"total":10}Why the result changes
The filter is valid; its empty output reveals the missing reduction policy. Providing zero also ensures that the first callback sees a numeric accumulator rather than a record object. That matters even for nonempty arrays: a one-element reduction without a seed can return that element without invoking the callback at all.
Choose and verify the correction
Write down the empty result and accumulator type. Sum often uses zero, multiplication often uses one, and record collection may use a fresh object or array. Minimum, average and first-item operations may need an explicit no-result value instead of a misleading numeric seed. Validate record fields before accumulation and decide what missing or invalid amounts mean. Include empty, one-item and ordinary inputs in the example you use to verify the contract.
Limits and next checks
A seed does not validate input types or prevent floating-point error. Choosing zero for a minimum over positive numbers would silently produce the wrong answer. Sparse arrays can have a positive length but no assigned element to seed a reduction. This fixture uses dense arrays, simple numbers and a deliberate zero total for no selected records; it is not a universal aggregation policy.
Related: 0.1 Plus 0.2 Differs from 0.3: Choose a Numeric Error Policy.
Isolated fixture executed on macOS on November 10, 2026 (KST), with v26.5.0. The observed output verifies this example, not every application or runtime.