You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: lt locale appends literal "undefined" to too_big/too_small messages for number, bigint, date and map #6655
The Lithuanian (lt) locale appends the literal word undefined to every too_big / too_small message whose origin has no size unit: number, bigint, date and map. When getSizing() returns null, the fallback branch still interpolates ${sizing?.unit}.
The bug happens whenever issue.origin is missing from the locale's Sizable table (in lt that's everything except string, file, array and set).
Actual behavior
Skaičius turi būti ne didesnis kaip 5 undefined
Date turi būti ne mažesnis kaip 5 undefined
Sveikasis skaičius turi būti ne didesnis kaip 5 undefined
Map turi būti ne didesnis kaip 1 undefined
Expected behavior
There should be no trailing undefined. For example Skaičius turi būti ne didesnis kaip 5, which is what the other locales do in their fallback branch (e.g. en: Too big: expected number to be <=5).
Environment
Version/commit: zod 4.6.6 (npm), also present on main at 284243f
OS: Ubuntu Linux, Node v24.21.0
Relevant configuration: z.config(z.locales.lt())
Evidence
packages/zod/src/v4/locales/lt.ts lines 196 (too_big) and 209 (too_small):
return`${capitalizeFirstCharacter(origin??issue.origin??"reikšmė")} turi būti ${adj}${issue.maximum.toString()}${sizing?.unit}`;
sizing is null on this path (the sizing?.verb branch above it has already returned for sized origins), so ${sizing?.unit} always renders undefined.
Additional context
Confirmed: the reproduction above, run against the published 4.6.6 package. I swept every locale over ~45 failing schemas and lt was the only one that leaks undefined this way.
Likely fix (not tested in a PR): drop the ${sizing?.unit} suffix from both fallback returns.
It drops the ${sizing?.unit} suffix from both lt fallback returns, which are only reached when sizing is null. It also adds a sweep to the locale parity test that renders every locale's too_big/too_small messages for number, bigint and date and fails on any undefined. Against the old lt.ts it reports exactly the six lt cases, and no other locale leaks. Happy to open a PR once that's possible.
Activity
peralva commentedon Oct 15, 2026
PRs are limited to collaborators, so the fix is on my fork: main...peralva:zod:fix/lt-unsized-size-undefined
It drops the
${sizing?.unit}suffix from bothltfallback returns, which are only reached whensizingis null. It also adds a sweep to the locale parity test that renders every locale'stoo_big/too_smallmessages for number, bigint and date and fails on anyundefined. Against the oldlt.tsit reports exactly the sixltcases, and no other locale leaks. Happy to open a PR once that's possible.