{"record":{"id":"51a514a8f3f7e69f","repo":"argoproj/argo-workflows","slug":"type-must-be-either-database-or-configmap","errorCode":null,"errorMessage":"--type must be either 'database' or 'configmap'","messagePattern":"--type must be either 'database' or 'configmap'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/sync/util.go","lineNumber":12,"sourceCode":"package sync\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\tsyncpkg \"github.com/argoproj/argo-workflows/v4/pkg/apiclient/sync\"\n)\n\nfunc validateFlags(syncType, cmName string) error {\n\tif _, ok := syncpkg.SyncConfigType_value[syncType]; !ok {\n\t\treturn fmt.Errorf(\"--type must be either 'database' or 'configmap'\")\n\t}\n\n\tif syncType == syncpkg.SyncConfigType_CONFIGMAP.String() && cmName == \"\" {\n\t\treturn fmt.Errorf(\"--cm-name is required when type is configmap\")\n\t}\n\n\treturn nil\n}\n\nfunc printSyncLimit(key, cmName, namespace string, limit int32, syncType syncpkg.SyncConfigType) {\n\tfmt.Printf(\"Key: %s\\n\", key)\n\tfmt.Printf(\"Type: %s\\n\", strings.ToLower(syncType.String()))\n\tif syncType == syncpkg.SyncConfigType_CONFIGMAP {\n\t\tfmt.Printf(\"ConfigMap Name: %s\\n\", cmName)\n\t}\n\tfmt.Printf(\"Namespace: %s\\n\", namespace)\n\tfmt.Printf(\"Limit: %d\\n\", limit)\n}","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/sync/util.go#L1-L30","documentation":"validateFlags checks the --type flag of sync limit commands against the known SyncConfigType enum values (database, configmap). This generic validation guard fires when the user passes any other --type string (including an empty one), rejecting the command before a request is sent to the server.","triggerScenarios":"Thrown at cmd/argo/commands/sync/util.go:12 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --type database or --type configmap"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}