Skip to content
Latchkey

Soda Core data source connection failed in CI

Soda tried to open the data source connection defined in configuration.yml and failed before any check ran. The warehouse host is unreachable, the port is wrong, or the credentials are missing in CI.

What this error means

A soda scan step ends with a connection or operational error naming the data source, with 0 checks evaluated because the scan never reached the warehouse.

soda
[ERROR] Error occurred while executing scan.
  could not connect to server: Connection refused
  Is the server running on host "localhost" (127.0.0.1) and accepting
  TCP/IP connections on port 5432?

Common causes

The warehouse service is not running in CI

The database container or service was not started, so the connection is refused.

Connection details or credentials are wrong

Host, port, database, or username/password in configuration.yml do not match the CI environment, or secrets were not injected.

How to fix it

Start the warehouse and wait for it

  1. Add the database as a service container with a health check.
  2. Wait until it is ready before running the scan.
  3. Point the data source at the service host and port.
.github/workflows/ci.yml
services:
  postgres:
    image: postgres:16
    env: { POSTGRES_PASSWORD: postgres }
    ports: ['5432:5432']
    options: >-
      --health-cmd "pg_isready -U postgres" --health-interval 5s
      --health-timeout 5s --health-retries 10

Source connection details from secrets

Interpolate host and credentials from env vars set from CI secrets so the scan connects to the right warehouse.

configuration.yml
data_source warehouse:
  type: postgres
  host: ${DB_HOST}
  username: ${DB_USER}
  password: ${DB_PASSWORD}

How to prevent it

  • Gate the scan behind a warehouse readiness check.
  • Keep credentials in CI secrets and interpolate them.
  • Match host/port to the CI service, not localhost defaults.

Frequently asked questions

What causes "Soda "connection ... failed""?
The database container or service was not started, so the connection is refused.
How do I fix Soda "connection ... failed"?
Start the warehouse and wait for it

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card