{"record":{"id":"56fe9efe79877315","repo":"argoproj/argo-workflows","slug":"couldn-t-decode-locks-for-session-w","errorCode":null,"errorMessage":"couldn't decode locks for session: %w","messagePattern":"couldn't decode locks for session: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/sync/sync_manager.go","lineNumber":481,"sourceCode":"\tholderKey := getHolderKey(wf, nodeName)\n\n\tlockKeys := make([]string, len(syncItems))\n\tfor i, syncItem := range syncItems {\n\t\tsyncLockName, lockNameErr := syncItem.lockName(wf.Namespace)\n\t\tif lockNameErr != nil {\n\t\t\treturn false, false, \"\", failedLockName, fmt.Errorf(\"requested configuration is invalid: %w\", lockNameErr)\n\t\t}\n\t\tsm.log.WithField(\"syncLockName\", syncLockName).Info(ctx, \"TryAcquire\")\n\t\tlockKeys[i] = syncLockName.String(ctx)\n\t}\n\n\tif ok, msg, prepLockName, prepErr := sm.prepAcquire(ctx, wf, holderKey, syncItems, lockKeys); !ok {\n\t\treturn false, false, msg, prepLockName, prepErr\n\t}\n\n\tneedDB, err := needDBSession(ctx, lockKeys)\n\tif err != nil {\n\t\treturn false, false, \"\", failedLockName, fmt.Errorf(\"couldn't decode locks for session: %w\", err)\n\t}\n\tif needDB && sm.dbInfo.SessionProxy == nil {\n\t\treturn false, false, \"\", failedLockName, fmt.Errorf(\"synchronization database session is not available\")\n\t}\n\tif needDB {\n\t\tvar updated bool\n\t\tvar already bool\n\t\tvar msg string\n\t\tvar newly []*acquiredLock\n\t\tbackoff := dbRetryBackoff\n\t\t// tryAcquireImpl mutates wf.Status.Synchronization in memory before the\n\t\t// transaction commits. Snapshot it and roll each failed attempt back, so\n\t\t// that attempts are independent and an error return leaves the caller's\n\t\t// status exactly as it was - otherwise an abort leaves a Holding entry\n\t\t// for a row the database rolled back, which would be persisted and then\n\t\t// failed as a stale hold on the next controller restart.\n\t\tsyncStatus := wf.Status.Synchronization.DeepCopy()\n\t\tattempt := 0","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/sync/sync_manager.go#L463-L499","documentation":"TryAcquire calls needDBSession to detect database-backed locks among the lock keys; if a key cannot be decoded the call aborts with 'couldn't decode locks for session'. A lock key string handed to the manager is not a valid encoded lock name.","triggerScenarios":"A lockKey produced from syncItem.lockName cannot be parsed during session detection — corrupted or unrecognized lock-name format reaching needDBSession.","commonSituations":"Mixed-version clusters where lock names were written in a format the current controller cannot decode; corrupted sync ConfigMaps; custom sync implementations emitting non-standard keys.","solutions":["Log and inspect the offending lock key to see why decoding fails","Align controller versions so lock-name encoding matches","Fix or regenerate the sync configuration producing the malformed name","Clear the stale lock record so the key is rebuilt from a valid reference"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if _, err := sync.DecodeLockName(ctx, lockKey); err != nil {\n    return fmt.Errorf(\"skip undecodable lock key %q: %w\", lockKey, err)\n}","typeGuard":"func decodableLockKey(ctx context.Context, key string) bool {\n    _, err := sync.DecodeLockName(ctx, key)\n    return err == nil\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"couldn't decode locks for session\") { /* quarantine the key, rebuild from spec */ }","preventionTips":["Keep controller and executor versions in lockstep","Never hand-edit sync state ConfigMaps","Add round-trip tests for lock name encode/decode"],"tags":["argo-workflows","sync","decoding","version-mismatch"],"backgroundTag":"lock-name-decode-failed","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"}