{"record":{"id":"45632516d937da7b","repo":"argoproj/argo-workflows","slug":"duplicate-synchronization-item-found","errorCode":null,"errorMessage":"duplicate synchronization item found","messagePattern":"duplicate synchronization item found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/sync/syncitems.go","lineNumber":30,"sourceCode":"\tmutex     *v1alpha1.Mutex\n}\n\nfunc allSyncItems(sync *v1alpha1.Synchronization) ([]*syncItem, error) {\n\tvar syncItems []*syncItem\n\tfor _, semaphore := range sync.Semaphores {\n\t\tsyncItems = append(syncItems, &syncItem{semaphore: semaphore})\n\t}\n\tfor _, mtx := range sync.Mutexes {\n\t\tsyncItems = append(syncItems, &syncItem{mutex: mtx})\n\t}\n\treturn syncItems, checkDuplicates(syncItems)\n}\n\nfunc checkDuplicates(items []*syncItem) error {\n\tfor i, item := range items {\n\t\tfor j := i + 1; j < len(items); j++ {\n\t\t\tif reflect.DeepEqual(*item, *items[j]) {\n\t\t\t\treturn errors.New(\"duplicate synchronization item found\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (i *syncItem) getType() v1alpha1.SynchronizationType {\n\tswitch {\n\tcase i.semaphore != nil:\n\t\treturn v1alpha1.SynchronizationTypeSemaphore\n\tcase i.mutex != nil:\n\t\treturn v1alpha1.SynchronizationTypeMutex\n\tdefault:\n\t\treturn v1alpha1.SynchronizationTypeUnknown\n\t}\n}\n","sourceCodeStart":12,"sourceCodeEnd":47,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/sync/syncitems.go#L12-L47","documentation":"When a workflow declares its synchronization section, Argo collects all sync items (semaphores and mutexes) and checks for duplicates with reflect.DeepEqual. If two entries in the list are exactly identical — same type, same namespace, name and key — the configuration is rejected as ambiguous, because the workflow would wait on the same lock twice. Note this error is created with errors.New without a code (plain error, not a coded ArgoError).","triggerScenarios":"Submitting or linting a workflow whose spec.synchronization contains two identical semaphore or mutex entries (e.g. the same configMapKeyRef name+key listed twice, or the same mutex twice). Raised from checkDuplicates, called by allSyncItems when building the sync items list.","commonSituations":"Copy-pasting a semaphore block within the same synchronization section; merging YAML fragments (e.g. via Kustomize patches or CI templating) that duplicate an entry; programmatically appending sync items without deduplication.","solutions":["Deduplicate spec.synchronization: keep one entry per unique semaphore/mutex in the workflow YAML","Search the rendered/templated manifest for repeated blocks (e.g. `grep -n \"configMapKeyRef\\|mutex\"`) and merge them","If duplicates come from overlays/patches, move the synchronization section to the base or use a single source of truth"],"exampleFix":"# before\nsynchronization:\n  mutexes:\n    - name: my-mutex\n    - name: my-mutex\n# after\nsynchronization:\n  mutexes:\n    - name: my-mutex","handlingStrategy":"validation","validationCode":"seen := map[string]bool{}\nfor _, m := range wf.Spec.Synchronization.Mutexes {\n    if seen[m.Name] { return fmt.Errorf(\"duplicate mutex %s\", m.Name) }\n    seen[m.Name] = true\n}","typeGuard":"func hasDuplicateSyncItems(items []v1alpha1.SemaphoreRef) bool {\n    seen := map[string]bool{}\n    for _, it := range items {\n        k := fmt.Sprintf(\"%v\", it)\n        if seen[k] { return true }\n        seen[k] = true\n    }\n    return false\n}","tryCatchPattern":"if err := wfv1.Validate(wf); err != nil {\n    return fmt.Errorf(\"workflow spec rejected: %w\", err) // surfaces duplicate synchronization item found\n}","preventionTips":["Keep at most one entry per unique semaphore/mutex under spec.synchronization","Deduplicate after any Helm/Kustomize templating before argo submit","Review rendered YAML with grep for repeated synchronization blocks"],"tags":["go","argo-workflows","synchronization","yaml","duplicate-config"],"backgroundTag":"duplicate-config-entry","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"}