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
- Ensure DATABASE_URL starts with the driver scheme (postgres://, mysql2://, sqlite3:).
- Confirm the value is actually exported to the step (not just defined at job level accidentally).
- Re-run and verify the adapter resolves.
.github/workflows/ci.yml
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/myapp_testSet 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_testHow 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
Rails "ActiveRecord::AdapterNotSpecified" in CIFix Rails "ActiveRecord::AdapterNotSpecified: The `test` database is not configured" in CI - the test environ…
Rails "PG::ConnectionBad: could not connect to server" in CIFix Rails "PG::ConnectionBad: could not connect to server" in CI - the Postgres service container is not reac…
Rails "Mysql2::Error: Can't connect to MySQL server" in CIFix Rails "Mysql2::Error::ConnectionError: Can't connect to MySQL server on '127.0.0.1'" in CI - the MySQL se…