
Safe Action Validation Errors
Guide for validation errors in next-safe-action, covering schema and manual field-level and form-level errors.
- CCM score
- 66 of 100
- skills.sh installs
- 1.2K
- GitHub stars
- 1
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers two error sources: automatic schema validation and manual checks via
returnValidationErrors()in server actions - Documents the default formatted shape with
_errorsarrays at each level, and the flattenedfieldErrorsandformErrorsalternative - Explains that
returnValidationErrors()always throws, so code paths after it never run - Designed for Next.js developers wiring server-action validation results into forms with Zod schemas
Install
$ npx -y skills add next-safe-action/skills --skill safe-action-validation-errors -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
next-safe-action Validation Errors
Two Sources of Validation Errors
- Schema validation — automatic when input doesn't match
.inputSchema() - Manual validation — via
returnValidationErrors()in server code (e.g., "email already taken")
Both produce the same error structure on the client.
Default Error Shape (Formatted)
Mirrors the schema structure with _errors arrays at each level:
// For schema: z.object({ email: z.string().email(), address: z.object({ city: z.string() }) })
{
_errors: ["Form-level error"], // root errors
email: { _errors: ["Invalid email address"] }, // field errors
address: {
_errors: ["Address section error"],
city: { _errors: ["City is required"] }, // nested field errors
},
}
returnValidationErrors
Throws a ActionServerValidationError that the framework catches and returns as result.validationErrors. It never returns — it always throws.
Details
- Repository
- github.com/next-safe-action/skills
- Categories
- Frontend & UI Code, Backend & APIs
- First seen
- May 16, 2026
More from next-safe-action/skills
All 8Similar to Safe Action Validation Errors
More Frontend & UI Code
safe-action-formsSkillnext-safe-action/skills1.3K installsForm integration patterns for next-safe-action, covering react-hook-form, native HTML forms, and file uploads.
safe-action-clientSkillnext-safe-action/skills1.3K installsTyped action client for next-safe-action with chainable input, output, and middleware validation for Standard Schema.
error-handling-uxSkillowl-listener/designer-skills2.7K installsCross-flow error prevention, detection, and recovery covering message content, placement, and escape routes.
python-error-handlingSkillwshobson/agents15.2K installsThis covers the error handling patterns you actually need in production Python code. It shows you how to validate inputs early with clear error messages, use Py
react-hook-form-zodPluginsecondsky/claude-skills254 starsType-safe React forms with React Hook Form and Zod validation. Use for form schemas, field arrays, multi-step forms, or encountering validation errors, resolver