{"record":{"id":"2af1d735c7672916","repo":"argoproj/argo-workflows","slug":"unsupported-db-type-s","errorCode":null,"errorMessage":"unsupported db type %s","messagePattern":"unsupported db type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"persist/sqldb/workflow_archive.go","lineNumber":248,"sourceCode":"\t\t\tselectQuery := baseSelector.Columns(\n\t\t\t\tdb.Raw(\"coalesce(metadata->>'labels', '{}') as labels\"),\n\t\t\t\tdb.Raw(\"coalesce(metadata->>'annotations', '{}') as annotations\"),\n\t\t\t\tdb.Raw(\"coalesce(status->>'progress', '') as progress\"),\n\t\t\t\t\"suspend\",\n\t\t\t\tdb.Raw(\"coalesce(arguments::text, '{}') as arguments\"),\n\t\t\t\tdb.Raw(\"coalesce(status->>'message', '') as message\"),\n\t\t\t\tdb.Raw(\"coalesce(status->>'estimatedDuration', '0') as estimatedduration\"),\n\t\t\t\tdb.Raw(\"coalesce(status->>'resourcesDuration', '{}') as resourcesduration\"),\n\t\t\t)\n\n\t\t\treturn s.SQL().\n\t\t\t\tIterator(\"WITH workflows AS ? ?\", cteSelector, selectQuery.From(\"workflows\")).\n\t\t\t\tAll(&archivedWfs)\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported db type %s\", r.dbType)\n\t}\n\n\twfs := make(wfv1.Workflows, len(archivedWfs))\n\tfor i, md := range archivedWfs {\n\t\tlabels := make(map[string]string)\n\t\tif err := json.Unmarshal([]byte(md.Labels), &labels); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// For backward compatibility, we should label workflow retrieved from DB as Persisted.\n\t\tlabels[common.LabelKeyWorkflowArchivingStatus] = \"Persisted\"\n\n\t\tannotations := make(map[string]string)\n\t\tif err := json.Unmarshal([]byte(md.Annotations), &annotations); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tt := md.CreationTimestamp\n","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/persist/sqldb/workflow_archive.go#L230-L266","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set the persistence config DBType to exactly \"mysql\" or \"postgres\" (check ARGO_ARCHIVE_* env vars / configmap)","Check how the persistence config is parsed and what value the env var actually holds","If using a custom DB, add a case for it in the ListWorkflows switch"],"exampleFix":"// before\nenv: \"postgres\"   # DBType\n// after\nenv: \"postgres\" → change config to: DBType: \"postgres\" (exact spelling accepted by sqldb)","handlingStrategy":"validation","validationCode":"import \"github.com/argoproj/argo-workflows/v4/persist/sqldb\"\n// accept only values the library understands\nif dbType != \"mysql\" && dbType != \"postgres\" {\n    return fmt.Errorf(\"DBType must be mysql or postgres, got %q\", dbType)\n}\narchive, err := sqldb.NewWorkflowArchive(session, offloadRepo, instanceID, dbType)","typeGuard":null,"tryCatchPattern":"wf, err := archiveClient.ListArchivedWorkflows(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"unsupported db type\") {\n    // fix deployment config; not retryable\n    return fmt.Errorf(\"archive misconfigured: %w\", err)\n}","preventionTips":["Pin DBType in your deployment config to the exact strings mysql/postgres","Validate persistence config in CI before deploy","Document accepted DBType values in your ops runbook"],"tags":["database","configuration","archive"],"backgroundTag":"unsupported-database-type","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}