.actionable()
Call .actionable() on any procedure to produce a function compatible with the Server Action calling convention. It wraps the call in a try/catch and returns [error, data] tuples instead of throwing:
ActionableClientResult
The return type of an actionable procedure is [error: null, data: TOutput] | [error: ErrorJSON, data: undefined].
When error is non-null, it is an ORPCErrorJSON object with:
| Property | Description |
|---|---|
code | The error code string |
status | HTTP status number |
message | Human-readable error message |
data | Optional structured data from .errors() |
defined | true if the error was declared in the error map |
@orpc/react — orpcAction
For integration with TanStack Query’s useMutation, @orpc/react provides orpcAction:
Special framework errors
Server Actions have special error types for redirects and not-found responses. oRPC detects and re-throws these automatically so framework navigation features work correctly:- Next.js:
error.digest?.startsWith('NEXT_')errors are re-thrown. - TanStack Router:
Responseinstances withoptionsproperty and{ isNotFound: true }objects are re-thrown.
With context
For procedures that require context (e.g., authentication), pass the context factory in.actionable():
