Some checks failed
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CI / typecheck + lint + boundaries + test + build (push) Has been cancelled
Coverage snapshot / snapshot (push) Has been cancelled
Release Please / release-please (push) Has been cancelled
Sentry PII guard (R31) / pii-guard (push) Has been cancelled
CI / Storybook smoke tests + visual regression (push) Has been cancelled
CI / Playwright e2e (push) Has been cancelled
Mutation testing (nightly) / mutate (push) Has been cancelled
Library trace revalidation (weekly) / revalidate (push) Has been cancelled
defineErrorMiddleware matched by instanceof only; the custom server's tsx-bound DI graph and the Next-compiled route handler each load their own copy of every error class, so mapped domain errors (e.g. UnauthenticatedError -> UNAUTHORIZED) fell through and surfaced as raw 500s — hit in production by a downstream app built from this template. Match on the canonical error name (probed from the constructor's string-literal this.name) with instanceof as the fast path; nameless classes stay identity-only so plain Errors never translate. ADR-027 records the decision and the now-load-bearing this.name convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>