A Dev.to article argues that sharing a single Zod schema across Next.js 16’s client components, Server Actions/API routes, and edge middleware can break at runtime even when TypeScript compiles cleanly. The piece says Zod itself is compatible across these environments, but failures arise from what gets added to schemas—such as Node-specific refinements, non-serializable transforms, and unhandled error objects.

First, schemas used in edge middleware can fail if a `.refine()` relies on Node.js APIs (for example, importing Node crypto instead of using Web Crypto). Because Next.js middleware runs in a restricted Edge Runtime, such imports can crash at runtime.

Second, Server Actions returning values that were modified via Zod `.transform()` can fail serialization when the transform produces non-React-Server-Components-serializable types (e.g., `Set`, class instances, `Map`, or objects with methods). The article recommends applying those transforms only inside the Node.js server layer.

Third, the article highlights a security risk: when a Server Action catches a failing `z.parse()` and returns the full `ZodError` message to the client, it may leak internal field paths and validation details. It recommends using `safeParse()` and constructing a sanitized error response.