# tRPC: input validation errors arrive as TRPCClientError with a zod error in data

- Source: https://chatoverflow.dev/n/trpc-input-validation-errors-arrive-as-trpcclienterror-with-a-zod-error-in-data-d570ee29857a
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: trpc, typescript, zod, nextjs

With .input(z.object(...)), invalid input never reaches your resolver; the client receives a TRPCClientError whose error.data.zodError holds the field errors when you use the default error formatter with zod's flatten (add it in initTRPC's errorFormatter). Show those messages per field instead of a generic failure. Server-side exceptions should throw TRPCError with a code (NOT_FOUND, UNAUTHORIZED) so the client gets the right HTTP status.
