{"record":{"id":"1b3cc64e09066933","repo":"argoproj/argo-workflows","slug":"no-databases-are-configured","errorCode":null,"errorMessage":"no databases are configured","messagePattern":"no databases are configured","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/sqldb/sqldb.go","lineNumber":45,"sourceCode":"\t// Database drivers - imported for side effects\n\t_ \"github.com/lib/pq\"\n)\n\nfunc CreateDBSession(ctx context.Context, kubectlConfig kubernetes.Interface, namespace string, dbConfig config.DBConfig) (db.Session, DBType, error) {\n\tif dbConfig.PostgreSQL != nil {\n\t\tsession, err := createPostGresDBSession(ctx, kubectlConfig, namespace, dbConfig.PostgreSQL, dbConfig.ConnectionPool, dbConfig.ConnectionTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, Invalid, err\n\t\t}\n\t\treturn session, Postgres, nil\n\t} else if dbConfig.MySQL != nil {\n\t\tsession, err := createMySQLDBSession(ctx, kubectlConfig, namespace, dbConfig.MySQL, dbConfig.ConnectionPool, dbConfig.ConnectionTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, Invalid, err\n\t\t}\n\t\treturn session, MySQL, err\n\t}\n\treturn nil, \"\", fmt.Errorf(\"no databases are configured\")\n}\n\n// CreateDBSessionWithCreds creates a database session using direct username and password\nfunc CreateDBSessionWithCreds(dbConfig config.DBConfig, username, password string) (db.Session, DBType, error) {\n\tif dbConfig.PostgreSQL != nil {\n\t\tsession, err := createPostGresDBSessionWithCreds(dbConfig.PostgreSQL, dbConfig.ConnectionPool, username, password, dbConfig.ConnectionTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, Invalid, err\n\t\t}\n\t\treturn session, Postgres, err\n\t} else if dbConfig.MySQL != nil {\n\t\tsession, err := createMySQLDBSessionWithCreds(dbConfig.MySQL, dbConfig.ConnectionPool, username, password, dbConfig.ConnectionTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, Invalid, err\n\t\t}\n\t\treturn session, MySQL, err\n\t}\n\treturn nil, \"\", fmt.Errorf(\"no databases are configured\")","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/sqldb/sqldb.go#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a persistence block with either postgresql: or mysql: (host, port, database, userNameSecret, passwordSecret) to the workflow-controller-configmap.","Verify the configmap is mounted and the controller picked it up (restart the pod after editing).","Check key spelling/casing of the YAML fields against config.DBConfig.","If persistence is not intended, disable archive/offload features instead of constructing a DB session."],"exampleFix":"# before\npersistence: {}\n# after\npersistence:\n  postgresql:\n    host: postgres\n    port: 5432\n    database: argo\n    userNameSecret:\n      name: argo-postgres-config\n      key: username\n    passwordSecret:\n      name: argo-postgres-config\n      key: password","handlingStrategy":"validation","validationCode":"if dbConfig.PostgreSQL == nil && dbConfig.MySQL == nil {\n\treturn errors.New(\"persistence misconfigured: set either postgresql or mysql in the workflow-controller-configmap\")\n}\nsession, dbType, err := sqldb.CreateDBSession(ctx, kubectlConfig, namespace, dbConfig)","typeGuard":null,"tryCatchPattern":"session, dbType, err := sqldb.CreateDBSession(ctx, kubectlConfig, namespace, dbConfig)\nif err != nil {\n\tif strings.Contains(err.Error(), \"no databases are configured\") {\n\t\treturn nil, fmt.Errorf(\"persistence config missing postgresql/mysql section: %w\", err)\n\t}\n\treturn nil, err\n}","preventionTips":["Always define a persistence block with exactly one of postgresql/mysql in the controller configmap.","Validate config at deploy time (helm/kustomize schema check) rather than at runtime.","Restart pods after configmap changes so the new DB section is loaded.","Keep YAML keys spelled exactly as the config struct expects (postgresql, mysql)."],"tags":["database","configuration","postgres","mysql"],"backgroundTag":"missing-database-config","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}