ActiveRecord::ConnectionNotEstablished Ruby / Rails Origin: Application & API Last updated 5 Nov 2026

Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found

ActiveRecord has no database connection configured or established for this process.

Exact message you may see ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' foundActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)Could not find adapter for databaseActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
Seen on: Ruby

Meaning

Check config/database.yml for the current RAILS_ENV, that DATABASE_URL is set, the connection isn't broken in forked processes (Puma/Unicorn/Sidekiq: reconnect after fork), and the adapter gem is installed. Also seen when using ActiveRecord outside Rails without establish_connection.

Common causes

  • Missing/invalid database.yml section for the env
  • DATABASE_URL not set
  • Forked workers reusing a closed connection
  • Adapter gem missing (pg/mysql2)
  • ActiveRecord used standalone without establish_connection

⚡ Quick fix

  1. Verify database.yml and RAILS_ENV
  2. Set DATABASE_URL correctly
  3. In forks use ActiveRecord::Base.establish_connection (or preload settings)

Detailed fix by platform

Rails

  1. bin/rails runner 'p ActiveRecord::Base.connection_db_config.configuration_hash.except(:password)'

How to diagnose

  1. Config — Present for env?
  2. Fork — Reconnected?
  3. Gem — Adapter installed?

🔧 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):

A server is already running. Check /tmp/pids/server.pid — Rails: A server is already running (pid: 12345, file: /app/tmp/pids/server.pid). Exiting (Ruby / Rails)A server is already r…AbstractController::DoubleRenderError — Rails: AbstractController::DoubleRenderError (Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action) (Ruby / Rails)AbstractController::D…ActionController::InvalidAuthenticityToken — Rails: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity) (Ruby / Rails)ActionController::Inv…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…ActionController::RoutingError: No route matches — Rails: ActionController::RoutingError (No route matches [GET] "/users/new") (Ruby / Rails)ActionController::Rou…ActionController::UnknownFormat — Rails: ActionController::UnknownFormat — UsersController#show is missing a template for this request format and variant (Ruby / Rails)ActionController::Unk…ActionController::UrlGenerationError: No route matches {action...} missing required keys — Rails: ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"users", :id=>nil}, missing required keys: [:id] (Ruby / Rails)ActionController::Url…ActionMailer: SMTP From address may not be blank / Net::SMTPAuthenticationError — Rails: ArgumentError: SMTP From address may not be blank: nil / Net::SMTPAuthenticationError: 535 5.7.8 Username and Password not accepted (Ruby / Rails)ActionMailer: SMTP Fr…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.