customizing-errors
Installation
SKILL.md
Handling Zod Errors
Purpose
Comprehensive guide to error handling in Zod v4, covering the unified error API, custom error messages, error formatting, and integration with UI frameworks.
Unified Error API
Overview
Zod v4 unified all error customization under a single error parameter, replacing multiple deprecated parameters.
v3 (deprecated):
z.string({ message: "Required" });
z.string({ invalid_type_error: "Must be string" });
z.string({ required_error: "Field required" });
z.object({}, { errorMap: customMap });