ActiveRecord::RecordInvalid: Validation failed Ruby / Rails Origin: Application & API OSI layer 7 · Application Last updated 5 Nov 2026

Rails: ActiveRecord::RecordInvalid: Validation failed: Email can't be blank, Name is too short

save!/create!/update! raised because validations failed.

Exact message you may see 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
Seen on: Ruby

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_to required by default)
  • Seeds/fixtures out of date
  • Locale/enum values invalid

⚡ Quick fix

  1. Inspect record.errors.full_messages
  2. Use save and handle false, or rescue RecordInvalid
  3. belongs_to :x, optional: true if the association isn't required

Detailed fix by platform

Rails

  1. u = User.new(attrs); u.valid?; puts u.errors.full_messages

How to diagnose

  1. Messages — Which fields?
  2. Association — Required?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

ActionController::ParameterMissing: param is missing or the value is empty — Rails: ActionController::ParameterMissing: param is missing or the value is empty: user (Ruby / Rails)ActionController::Par…ActiveModel::ForbiddenAttributesError (strong parameters) — Rails: ActiveModel::ForbiddenAttributesError (Ruby / Rails)ActiveModel::Forbidde…ActiveRecord::AssociationTypeMismatch — Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678) (Ruby / Rails)ActiveRecord::Associa…ActiveRecord::ConnectionNotEstablished — Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found (Ruby / Rails)ActiveRecord::Connect…ActiveRecord::Deadlocked: PG::TRDeadlockDetected — Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected (Ruby / Rails)ActiveRecord::Deadloc…ActiveRecord::ReadOnlyRecord — Rails: ActiveRecord::ReadOnlyRecord: Order is marked as readonly (Ruby / Rails)ActiveRecord::ReadOnl…ActiveRecord::RecordNotFound: Couldn't find X with 'id'= — Rails: ActiveRecord::RecordNotFound: Couldn't find User with 'id'=42 (Ruby / Rails)ActiveRecord::RecordN…ActiveRecord::RecordNotUnique: duplicate key value — Rails: ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email" (Ruby / Rails)ActiveRecord::RecordN…ActiveRec…

Explore the map of this error Full error map →

🧠 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.