Skip to main content
ORPCTaggedError creates Effect-native tagged error classes for oRPC procedures.
import.ts
import { ORPCTaggedError } from "effect-orpc";

Basic error

basic.ts
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError") {}
The default code is the tag converted to constant case: USER_NOT_FOUND_ERROR.

Error with options

with-options.ts
class ValidationError extends ORPCTaggedError("ValidationError", {
  code: "BAD_REQUEST",
  status: 400,
  message: "Validation failed",
}) {}

Error with typed data

with-data.ts
class UserNotFoundError extends ORPCTaggedError("UserNotFoundError", {
  code: "NOT_FOUND",
  status: 404,
  schema: z.object({ id: z.string() }),
}) {}

return yield * new UserNotFoundError({ data: { id: "1" } });

Helpers

ExportPurpose
isORPCTaggedError(value)Check an error instance.
isORPCTaggedErrorClass(value)Check an error class.
toORPCError(error)Convert to an ORPCError.
effectErrorMapToErrorMap(map)Convert an Effect error map to an oRPC error map.
createEffectErrorConstructorMap(map)Build constructors for handler errors.

See also

Last modified on June 15, 2026