`~standard.validate()` re-parses async schemas, running every transform and refinement twice
Author: florian-lefebvreCreated Sep 16, 2026Updated Sep 16, 2026
I'm working on adopting Standard Schema in Astro: https://github.com/withastro/astro/pull/17892.
While working on it, I encountered some issues that required me to make a local patch. Summary from Claude: z.object()'s compiled fastpass assumes every member parses synchronously, so an async member blew up with an opaque TypeError and stranded its promise as an unhandled rejection. ~standard.validate papered over that by parsing a second time in async mode — which ran every async transform and refinement twice.
I have a fix implemented at https://github.com/florian-lefebvre/zod_zod/tree/florian-lefebvre/apply-astro-17892-zod but cannot send a PR.
Source: colinhacks/zod