{"record":{"id":"84d01a9850abeb91","repo":"argoproj/argo-workflows","slug":"invalid-lock-kind-s-when-initializing-mutex","errorCode":null,"errorMessage":"invalid lock kind %s when initializing mutex","messagePattern":"invalid lock kind (.+?) when initializing mutex","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/sync/sync_manager.go","lineNumber":878,"sourceCode":"\t\treturn nil, fmt.Errorf(\"invalid lock kind %s when initializing semaphore\", lock.getKind())\n\t}\n}\n\nfunc (sm *Manager) initializeMutex(ctx context.Context, mutexName string) (semaphore, error) {\n\tlock, err := DecodeLockName(ctx, mutexName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch lock.getKind() {\n\tcase lockKindMutex:\n\t\treturn newInternalMutex(mutexName, sm.nextWorkflow), nil\n\tcase lockKindDatabase:\n\t\tif sm.dbInfo.SessionProxy == nil {\n\t\t\treturn nil, fmt.Errorf(\"database session is not available for mutex %s\", mutexName)\n\t\t}\n\t\treturn newDatabaseMutex(mutexName, lock.getDBKey(), sm.nextWorkflow, sm.dbInfo), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid lock kind %s when initializing mutex\", lock.getKind())\n\t}\n}\n\nfunc (sm *Manager) backgroundNotifier(ctx context.Context, period *int) {\n\tsm.log.WithField(\"pollInterval\", syncdb.SecondsToDurationWithDefault(period, syncdb.DefaultDBHeartbeatSeconds)).\n\t\tInfo(ctx, \"Starting background notification for sync locks\")\n\tgo wait.UntilWithContext(ctx, func(_ context.Context) {\n\t\tsm.lock.Lock()\n\t\tfor _, lock := range sm.syncLockMap {\n\t\t\tlock.probeWaiting(ctx)\n\t\t}\n\t\tsm.lock.Unlock()\n\t},\n\t\tsyncdb.SecondsToDurationWithDefault(period, syncdb.DefaultDBPollSeconds),\n\t)\n}\n\n// dbControllerHeartbeat does periodic deadmans switch updates to the controller state","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/sync/sync_manager.go#L860-L896","documentation":"initializeMutex validates that the resolved lock kind is one of the supported kinds (mutex/configmap or database). If a sync resource resolves to an unrecognized kind, initialization is rejected with this error. It guards against malformed or future-unknown lock kind declarations.","triggerScenarios":"A sync ConfigMap entry declares a kind value that is neither 'mutex' (configmap) nor 'database', and a workflow tries to acquire it through prepAcquire -> initializeMutex.","commonSituations":"Typo in the lock kind field in a sync ConfigMap (e.g. 'databse', 'semaphre'); hand-edited or older-version sync ConfigMaps using a kind string no longer supported; copying examples with invalid kind values.","solutions":["Correct the lock kind in the sync ConfigMap to a supported value ('configmap' for mutex/semaphore or 'database')","Re-apply the sync ConfigMap from a known-good example and verify with kubectl get configmap","Check controller version compatibility — kind strings may differ across Argo Workflows versions"],"exampleFix":"// before (sync ConfigMap)\nkind: databse\n// after\nkind: database","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"configmap\": true, \"database\": true}\nif !allowed[strings.ToLower(lockKind)] {\n    return fmt.Errorf(\"sync lock kind %q not supported\", lockKind)\n}","typeGuard":"func isKnownLockKind(k string) bool {\n    return k == \"configmap\" || k == \"database\"\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid lock kind\") {\n    log.Fatalf(\"fix sync ConfigMap kind field: %v\", err)\n}","preventionTips":["Copy lock kind values only from official Argo docs/examples","Validate sync ConfigMaps in CI with the WorkflowSpec schema","Avoid hand-editing sync ConfigMaps in production"],"tags":["sync","mutex","configuration","validation"],"backgroundTag":"invalid-lock-kind","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"}