argoproj/argo-workflows · error

no databases are configured

Error message

no databases are configured

What it means

CreateDBSession builds a persistence session from config.DBConfig, but neither the PostgreSQL nor the MySQL section is configured, so there is nothing to connect to. It is a configuration error returned at persistence initialization, wrapped as an Invalid (bad request class) error by NewPersistence.

Source

Thrown at util/sqldb/sqldb.go:45

	// Database drivers - imported for side effects
	_ "github.com/lib/pq"
)

func CreateDBSession(ctx context.Context, kubectlConfig kubernetes.Interface, namespace string, dbConfig config.DBConfig) (db.Session, DBType, error) {
	if dbConfig.PostgreSQL != nil {
		session, err := createPostGresDBSession(ctx, kubectlConfig, namespace, dbConfig.PostgreSQL, dbConfig.ConnectionPool, dbConfig.ConnectionTimeout())
		if err != nil {
			return nil, Invalid, err
		}
		return session, Postgres, nil
	} else if dbConfig.MySQL != nil {
		session, err := createMySQLDBSession(ctx, kubectlConfig, namespace, dbConfig.MySQL, dbConfig.ConnectionPool, dbConfig.ConnectionTimeout())
		if err != nil {
			return nil, Invalid, err
		}
		return session, MySQL, err
	}
	return nil, "", fmt.Errorf("no databases are configured")
}

// CreateDBSessionWithCreds creates a database session using direct username and password
func CreateDBSessionWithCreds(dbConfig config.DBConfig, username, password string) (db.Session, DBType, error) {
	if dbConfig.PostgreSQL != nil {
		session, err := createPostGresDBSessionWithCreds(dbConfig.PostgreSQL, dbConfig.ConnectionPool, username, password, dbConfig.ConnectionTimeout())
		if err != nil {
			return nil, Invalid, err
		}
		return session, Postgres, err
	} else if dbConfig.MySQL != nil {
		session, err := createMySQLDBSessionWithCreds(dbConfig.MySQL, dbConfig.ConnectionPool, username, password, dbConfig.ConnectionTimeout())
		if err != nil {
			return nil, Invalid, err
		}
		return session, MySQL, err
	}
	return nil, "", fmt.Errorf("no databases are configured")

View on GitHub (pinned to 35bff19146)

Solutions

  1. Add a persistence block with either postgresql: or mysql: (host, port, database, userNameSecret, passwordSecret) to the workflow-controller-configmap.
  2. Verify the configmap is mounted and the controller picked it up (restart the pod after editing).
  3. Check key spelling/casing of the YAML fields against config.DBConfig.
  4. If persistence is not intended, disable archive/offload features instead of constructing a DB session.

Example fix

# before
persistence: {}
# after
persistence:
  postgresql:
    host: postgres
    port: 5432
    database: argo
    userNameSecret:
      name: argo-postgres-config
      key: username
    passwordSecret:
      name: argo-postgres-config
      key: password
Defensive patterns

Strategy: validation

Validate before calling

if dbConfig.PostgreSQL == nil && dbConfig.MySQL == nil {
	return errors.New("persistence misconfigured: set either postgresql or mysql in the workflow-controller-configmap")
}
session, dbType, err := sqldb.CreateDBSession(ctx, kubectlConfig, namespace, dbConfig)

Try / catch

session, dbType, err := sqldb.CreateDBSession(ctx, kubectlConfig, namespace, dbConfig)
if err != nil {
	if strings.Contains(err.Error(), "no databases are configured") {
		return nil, fmt.Errorf("persistence config missing postgresql/mysql section: %w", err)
	}
	return nil, err
}

Prevention

When it happens

Trigger: Calling CreateDBSession (via NewPersistence, setupDBSession, or connect during SessionProxy reconnection) with a DBConfig where both dbConfig.PostgreSQL and dbConfig.MySQL are nil — e.g. empty persistence config, wrong configmap key, or config not mounted.

Common situations: Argo server/controller started without the workflow-controller-configmap persistence section; typo'd config key (e.g. 'postgres' instead of 'postgresql'); persistence block removed during upgrade; configmap not mounted into the pod.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/1b3cc64e09066933. Report an issue: GitHub.