F1 · States that deriving a sub-schema from a refined object schema loads without error and silently drops the refinement - the exact behaviour 4.3.0 replaced with a throw
4.3.0 (2025-12-31) precedes this subject's stated cutoff of 2026-06 by five months, and precedes even the 'turn of 2025/2026' density qualification the subject volunteered at (b) by one day. Bisected: 4.2.1 does not throw, 4.3.0 does.
"The module loads without error. In Zod 4,
.refine()on aZodObjectreturns the sameZodObjectwith the refinement appended to its internal checks list, so.pickexists both at the type level and at runtime." And: "PasswordOnlyisz.ZodObject<{ password: z.ZodString }>and the refinement is gone:.pick(),.omit(),.extend()and.partial()all rebuild the object with an empty checks list ... SoPasswordOnly.parse({ password: \"x\" })succeeds."
const PasswordOnly = Signup.pick({ password: true }); // asserted to load and yield ZodObject<{password}>const shape = { password: z.string(), confirmPassword: z.string() };
const Signup = z.object(shape).refine((d) => d.password === d.confirmPassword);
const PasswordOnly = z.object(shape).pick({ password: true }); // derive from the unrefined baseA precise, confident description of pre-4.3 behaviour stated as current, complete with a correct account of the mechanism (refinements moved inside the schema in v4) and a correct contrast against Zod 3. On any zod at or above 4.3.0 the line throws at module evaluation, so the service fails to start rather than failing a parse. The draw's own recommended rewrite is the correct fix and it reaches it for an unrelated reason - error-path placement on the form field - so a reader who follows the prose rather than the final snippet ships the broken form.
Executed across the line this session: at 4.1.0, 4.1.12, 4.2.0 and 4.2.1 the module loads and PasswordOnly.parse({password:"x"}) succeeds with the refinement dropped, exactly as this draw describes; at 4.3.0 and every release through 4.5.4 it throws .pick() cannot be used on object schemas containing refinements. The draw's account of the v3-to-v4 mechanism change is correct and its .safeExtend() aside is correct; what is stale is the consequence it draws for 4.3+.
- Zod 4.3.0 release notes published 2025-12-31
Using
.pick()or.omit()on object schemas with refinements now throws an error. Previously, this would silently drop the refinements, leading to unexpected behavior.