Rails: ActiveRecord::RecordInvalid: Validation failed: Email can't be blank, Name is too short
save!/create!/update! raised because validations failed.
ActiveRecord::RecordInvalid: Validation failed: Email can't be blankValidation failed: Name is too short (minimum is 3 characters)ActiveRecord::RecordInvalid (Validation failed: User must exist)Validation failed: Email has already been takenRecordInvalid Validation failed Meaning
Read the messages after "Validation failed:". Use record.errors.full_messages to inspect, fix the data/validations, or use non-bang save (returns false) in controllers and re-render the form. Seeds and jobs often call create! with incomplete data.
Common causes
- Required attribute blank
- Uniqueness/format/length validation failing
- Callback or association validation (
belongs_torequired by default) - Seeds/fixtures out of date
- Locale/enum values invalid
⚡ Quick fix
- Inspect
record.errors.full_messages - Use
saveand handlefalse, or rescueRecordInvalid belongs_to :x, optional: trueif the association isn't required
Detailed fix by platform
Rails
u = User.new(attrs); u.valid?; puts u.errors.full_messages
How to diagnose
- Messages — Which fields?
- Association — Required?
- Source — Seeds/forms?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- ActionController::ParameterMissing: param is missing or the value is empty Rails: ActionController::ParameterMissing: param is missing or the value is empty: user
- ActiveModel::ForbiddenAttributesError (strong parameters) Rails: ActiveModel::ForbiddenAttributesError
- ActiveRecord::AssociationTypeMismatch Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678)
Most viewed in Ruby / Rails
- ActiveRecord::PendingMigrationError Rails: ActiveRecord::PendingMigrationError — Migrations are pending. To resolve this issue, run: bin/rails db:migrate
- ActionController::InvalidAuthenticityToken Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity)
- undefined method for nil Ruby: NoMethodError: undefined method `x' for nil (nil:NilClass)
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026