npx skills add ...
npx skills add next-safe-action/skills --skill safe-action-validation-errors
Use when working with validation errors -- returnValidationErrors, formatted vs flattened shapes, custom validation error shapes, throwValidationErrors, or displaying field-level and form-level errors
npx skills add next-safe-action/skills --skill safe-action-validation-errors
.inputSchema()returnValidationErrors() in server code (e.g., "email already taken")Both produce the same error structure on the client.
Mirrors the schema structure with _errors arrays at each level:
Throws a ActionServerValidationError that the framework catches and returns as result.validationErrors. It never returns — it always throws.
For expected non-validation errors ("out of stock", "not found"), the sibling helper
returnServerError(payload)works the same way (throws internally, never returns) but setsresult.serverErrorto the typed payload, bypassinghandleServerError. See the safe-action-client skill.
Use _errors at the top level for form-wide errors: