When parsing inputs that may be invalid (e.g., string → boolean), do not rely on implicit/unclear failure behavior. Instead, decide explicitly how parse errors should be handled and make it deterministic.

Apply this by:

Example (explicit error recovery to a boolean):

import { z } from "zod";

// Logical boolean parsing with deterministic fallback on error
const b = z.string()
  .boolean()
  .catch(() => false); // whenever parsing fails

b.parse("true");   // true
b.parse("False");  // false
b.parse("other");  // false (fallback)

If you expect JS-like coercion semantics instead of strict logical strings, prefer:

const b = z.coerce.boolean();