Repro
package.json: { "perry": { "compilePackages": ["zod"], "allow": { "compilePackages": ["zod"] } } }
import { z } from "zod";
const r = z.object({ a: z.string() }).safeParse({ a: 123 });
console.log("success:", r.success);
Perry:
TypeError: error is not a function
at <anonymous>
Node (--experimental-strip-types): success: false
The valid path is fine — z.object({a:z.string()}).parse({a:"hi"}) returns {a:"hi"} and matches Node (after #4697). This only fires on the validation-failure / issue-reporting path, where zod constructs a ZodError / formats issues. Something bound as error is being invoked as a function and is not callable (likely a ZodError constructor, an error-named export, or an issue-map/config().customError callback that resolved to a non-function across the perry.compilePackages module boundary).
Context
Follow-up to discussion #3438. Core object parsing fixed by #4697. This is the error/issue-construction path; the checks-path crash is tracked separately (#4698). Refs #793.
Next step: localize which error symbol is non-callable — core/errors.ts ($ZodError / $ZodRealError) and the config() error-map plumbing are the prime suspects.
Repro
package.json:{ "perry": { "compilePackages": ["zod"], "allow": { "compilePackages": ["zod"] } } }Perry:
Node (
--experimental-strip-types):success: falseThe valid path is fine —
z.object({a:z.string()}).parse({a:"hi"})returns{a:"hi"}and matches Node (after #4697). This only fires on the validation-failure / issue-reporting path, where zod constructs aZodError/ formats issues. Something bound aserroris being invoked as a function and is not callable (likely aZodErrorconstructor, anerror-named export, or an issue-map/config().customErrorcallback that resolved to a non-function across theperry.compilePackagesmodule boundary).Context
Follow-up to discussion #3438. Core object parsing fixed by #4697. This is the error/issue-construction path; the checks-path crash is tracked separately (#4698). Refs #793.
Next step: localize which
errorsymbol is non-callable —core/errors.ts($ZodError/$ZodRealError) and theconfig()error-map plumbing are the prime suspects.