{"record":{"id":"cb25c1d5369e7be8","repo":"juicedata/juicefs","slug":"invalid-owner-key-s","errorCode":null,"errorMessage":"invalid owner key: %s","messagePattern":"invalid owner key: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/utils.go","lineNumber":209,"sourceCode":"type ownerKey struct {\n\tSid   uint64\n\tOwner uint64\n}\n\ntype PLockItem struct {\n\townerKey\n\tplockRecord\n}\n\ntype FLockItem struct {\n\townerKey\n\tType string\n}\n\nfunc parseOwnerKey(key string) (*ownerKey, error) {\n\tpair := strings.Split(key, \"_\")\n\tif len(pair) != 2 {\n\t\treturn nil, fmt.Errorf(\"invalid owner key: %s\", key)\n\t}\n\tsid, err := strconv.ParseUint(pair[0], 10, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\towner, err := strconv.ParseUint(pair[1], 16, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ownerKey{sid, owner}, nil\n}\n\nfunc loadLocks(d []byte) []plockRecord {\n\tvar ls []plockRecord\n\trb := utils.FromBuffer(d)\n\tfor rb.HasMore() {\n\t\tls = append(ls, plockRecord{rb.Get32(), rb.Get32(), rb.Get64(), rb.Get64()})\n\t}","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/utils.go#L191-L227","documentation":"parseOwnerKey in pkg/meta/utils.go decodes flock/fcntl lock owner keys of the form \"<sid>_<ownerHex>\". It returns this error when the key does not split into exactly two underscore-separated parts, i.e. the stored key is malformed or belongs to a different key format than expected by ListLocks.","triggerScenarios":"ListLocks iterating keys in the lock owner-key space that were written by a different/older format, or corrupt/foreign keys present under the lock prefix.","commonSituations":"Upgrading from an older JuiceFS version whose lock key layout differed; manual edits or dumps/loads that mangled keys; a bug writing owner keys without the underscore separator.","solutions":["Verify how owner keys are produced (ownerKey formatting in pkg/meta) and confirm the stored key format matches \"<sid>_<ownerHex>\"","Inspect the offending key(s) in the metadata engine and repair or remove malformed entries","If old-format keys exist after an upgrade, migrate them or skip/convert them in ListLocks defensively","Report the exact key to maintainers if it was written by the current version — it indicates a write-path bug"],"exampleFix":"// before: blindly parse\nok, _ := parseOwnerKey(key)\n// after: skip malformed keys defensively\nif _, err := parseOwnerKey(key); err != nil {\n  logger.Warnf(\"skip malformed owner key %q: %s\", key, err)\n  continue\n}","handlingStrategy":"validation","validationCode":"parts := strings.Split(key, \"_\"); if len(parts) != 2 { /* skip or repair malformed key */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit lock keys in the metadata engine","Validate key format after dump/load or version migrations","Skip-and-log malformed keys when iterating lock keyspace in tooling"],"tags":["locking","metadata","key-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}