Skip to content
Latchkey

Rails "database configuration does not specify adapter" in CI

ActiveRecord resolved a database configuration but it contains no adapter key, so it cannot decide which driver (postgresql, mysql2, sqlite3) to load. In CI this often comes from a malformed or empty DATABASE_URL.

What this error means

Boot fails with "ActiveRecord::AdapterNotFound: database configuration does not specify adapter" or "The adapter key is missing".

Rails
ActiveRecord::AdapterNotFound: database configuration does not specify adapter (ActiveRecord::AdapterNotFound)

Common causes

DATABASE_URL is empty or has no scheme

A blank or scheme-less DATABASE_URL yields a config with no adapter, so ActiveRecord cannot infer the driver.

The test block omits adapter

A test: section that only sets database: and relies on a default that is not present leaves the adapter unspecified.

How to fix it

Set a URL with a valid scheme

  1. Ensure DATABASE_URL starts with the driver scheme (postgres://, mysql2://, sqlite3:).
  2. Confirm the value is actually exported to the step (not just defined at job level accidentally).
  3. Re-run and verify the adapter resolves.
.github/workflows/ci.yml
env:
  DATABASE_URL: postgres://postgres:postgres@localhost:5432/myapp_test

Set adapter explicitly in database.yml

Name the adapter in the test block so the driver is unambiguous even without a URL.

config/database.yml
test:
  adapter: postgresql
  database: myapp_test

How to prevent it

  • Always include a scheme in DATABASE_URL.
  • Set adapter explicitly in each environment block.
  • Echo the resolved config in a debug step when connections misbehave.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →