{"record":{"id":"f0a97b584f22161e","repo":"argoproj/argo-workflows","slug":"cannot-get-lockname-for-a-semaphore-without-a-conf","errorCode":null,"errorMessage":"cannot get LockName for a Semaphore without a ConfigMapRef or Database","messagePattern":"cannot get LockName for a Semaphore without a ConfigMapRef or Database","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/sync/lock_name.go","lineNumber":69,"sourceCode":"\nfunc getSemaphoreLockName(sem *v1alpha1.SemaphoreRef, wfNamespace string) (*lockName, error) {\n\tswitch {\n\tcase sem.ConfigMapKeyRef != nil && sem.Database != nil:\n\t\treturn nil, fmt.Errorf(\"invalid semaphore with both ConfigMapKeyRef and Database\")\n\tcase sem.ConfigMapKeyRef != nil:\n\t\tnamespace := sem.Namespace\n\t\tif namespace == \"\" {\n\t\t\tnamespace = wfNamespace\n\t\t}\n\t\treturn newLockName(namespace, sem.ConfigMapKeyRef.Name, sem.ConfigMapKeyRef.Key, lockKindConfigMap), nil\n\tcase sem.Database != nil:\n\t\tnamespace := sem.Namespace\n\t\tif namespace == \"\" {\n\t\t\tnamespace = wfNamespace\n\t\t}\n\t\treturn newLockName(namespace, sem.Database.Key, \"\", lockKindDatabase), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"cannot get LockName for a Semaphore without a ConfigMapRef or Database\")\n\t}\n}\n\nfunc getMutexLockName(mtx *v1alpha1.Mutex, wfNamespace string) *lockName {\n\tnamespace := mtx.Namespace\n\tif namespace == \"\" {\n\t\tnamespace = wfNamespace\n\t}\n\tif mtx.Database {\n\t\treturn newLockName(namespace, mtx.Name, \"\", lockKindDatabase)\n\t}\n\treturn newLockName(namespace, mtx.Name, \"\", lockKindMutex)\n}\n\nfunc (i *syncItem) lockName(wfNamespace string) (*lockName, error) {\n\tswitch {\n\tcase i.semaphore != nil:\n\t\treturn getSemaphoreLockName(i.semaphore, wfNamespace)","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/sync/lock_name.go#L51-L87","documentation":"getSemaphoreLockName reached its default branch: the SemaphoreRef has neither ConfigMapKeyRef nor Database set, so no lock identity can be derived. The controller cannot track or acquire a semaphore that names no backend.","triggerScenarios":"A workflow declares `synchronization.semaphore: {}` (empty object) or a rendered template resolves the semaphore ref to nil fields; getSemaphoreLockName falls through to default.","commonSituations":"Partial template substitution leaving the semaphore block empty; YAML mistakes like a mis-indented configMapKeyRef so it parses as a sibling key; programmatically constructed workflow specs with unset fields.","solutions":["Set either `configMapKeyRef` (name+key) or `database` (key) on the semaphore","Lint with `argo lint` before submitting to catch the empty ref","Inspect the submitted workflow spec (`argo get <wf> -o yaml`) to see what actually rendered"],"exampleFix":"// before\nsynchronization:\n  semaphore: {}\n// after\nsynchronization:\n  semaphore:\n    configMapKeyRef:\n      name: my-cm\n      key: my-key","handlingStrategy":"validation","validationCode":"func validateSemaphoreRef(sem *SemaphoreRef) error {\n    if sem == nil || (sem.ConfigMapKeyRef == nil && sem.Database == nil) {\n        return fmt.Errorf(\"semaphore requires configMapKeyRef or database\")\n    }\n    return nil\n}","typeGuard":"func semaphoreRefHasBackend(sem *SemaphoreRef) bool {\n    return sem != nil && (sem.ConfigMapKeyRef != nil || sem.Database != nil)\n}","tryCatchPattern":"err := wf.Submit(ctx)\nif err != nil && strings.Contains(err.Error(), \"without a ConfigMapRef or Database\") {\n    return fmt.Errorf(\"populate the semaphore ref in the spec: %w\", err)\n}","preventionTips":["Lint templates after any templating/substitution that could leave fields empty","Check rendered output (`argo get -o yaml`) when using Helm/Kustomize to inject sync config","Never hand-write `semaphore: {}` placeholders"],"tags":["configuration","semaphore","validation"],"backgroundTag":"empty-semaphore-ref","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"}