argoproj/argo-workflows · error

unsupported db type %s

Error message

unsupported db type %s

What it means

workflowArchive.ListWorkflows switches on the configured r.dbType (MySQL vs Postgres) to build the archive query. If dbType holds anything else the SQL dialect is unknown, so it returns an explicit unsupported-db-type error instead of emitting invalid SQL.

Source

Thrown at persist/sqldb/workflow_archive.go:248

			selectQuery := baseSelector.Columns(
				db.Raw("coalesce(metadata->>'labels', '{}') as labels"),
				db.Raw("coalesce(metadata->>'annotations', '{}') as annotations"),
				db.Raw("coalesce(status->>'progress', '') as progress"),
				"suspend",
				db.Raw("coalesce(arguments::text, '{}') as arguments"),
				db.Raw("coalesce(status->>'message', '') as message"),
				db.Raw("coalesce(status->>'estimatedDuration', '0') as estimatedduration"),
				db.Raw("coalesce(status->>'resourcesDuration', '{}') as resourcesduration"),
			)

			return s.SQL().
				Iterator("WITH workflows AS ? ?", cteSelector, selectQuery.From("workflows")).
				All(&archivedWfs)
		}); err != nil {
			return nil, err
		}
	default:
		return nil, fmt.Errorf("unsupported db type %s", r.dbType)
	}

	wfs := make(wfv1.Workflows, len(archivedWfs))
	for i, md := range archivedWfs {
		labels := make(map[string]string)
		if err := json.Unmarshal([]byte(md.Labels), &labels); err != nil {
			return nil, err
		}
		// For backward compatibility, we should label workflow retrieved from DB as Persisted.
		labels[common.LabelKeyWorkflowArchivingStatus] = "Persisted"

		annotations := make(map[string]string)
		if err := json.Unmarshal([]byte(md.Annotations), &annotations); err != nil {
			return nil, err
		}

		t := md.CreationTimestamp

View on GitHub (pinned to 35bff19146)

Solutions

  1. Set the persistence config DBType to exactly "mysql" or "postgres" (check ARGO_ARCHIVE_* env vars / configmap)
  2. Check how the persistence config is parsed and what value the env var actually holds
  3. If using a custom DB, add a case for it in the ListWorkflows switch

Example fix

// before
env: "postgres"   # DBType
// after
env: "postgres" → change config to: DBType: "postgres" (exact spelling accepted by sqldb)
Defensive patterns

Strategy: validation

Validate before calling

import "github.com/argoproj/argo-workflows/v4/persist/sqldb"
// accept only values the library understands
if dbType != "mysql" && dbType != "postgres" {
    return fmt.Errorf("DBType must be mysql or postgres, got %q", dbType)
}
archive, err := sqldb.NewWorkflowArchive(session, offloadRepo, instanceID, dbType)

Try / catch

wf, err := archiveClient.ListArchivedWorkflows(ctx, req)
if err != nil && strings.Contains(err.Error(), "unsupported db type") {
    // fix deployment config; not retryable
    return fmt.Errorf("archive misconfigured: %w", err)
}

Prevention

When it happens

Trigger: Creating the archive repo with a DBType string that is neither "mysql" nor "postgres" (it is set from the ARGO_ARCHIVE_PROBE_DBTYPE / persistence config env vars).

Common situations: Typo in the persistence configuration (e.g. "postgresql", "postgres", "MySQL" casing variants depending on how config is parsed); missing env var causing a stale or empty dbType; custom builds wiring an in-memory or other DB without a case in the switch.

Related errors


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