juicedata/juicefs · error
invalid owner key: %s
Error message
invalid owner key: %s
What it means
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.
Source
Thrown at pkg/meta/utils.go:209
type ownerKey struct {
Sid uint64
Owner uint64
}
type PLockItem struct {
ownerKey
plockRecord
}
type FLockItem struct {
ownerKey
Type string
}
func parseOwnerKey(key string) (*ownerKey, error) {
pair := strings.Split(key, "_")
if len(pair) != 2 {
return nil, fmt.Errorf("invalid owner key: %s", key)
}
sid, err := strconv.ParseUint(pair[0], 10, 64)
if err != nil {
return nil, err
}
owner, err := strconv.ParseUint(pair[1], 16, 64)
if err != nil {
return nil, err
}
return &ownerKey{sid, owner}, nil
}
func loadLocks(d []byte) []plockRecord {
var ls []plockRecord
rb := utils.FromBuffer(d)
for rb.HasMore() {
ls = append(ls, plockRecord{rb.Get32(), rb.Get32(), rb.Get64(), rb.Get64()})
}View on GitHub (pinned to c9a67b23e8)
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
Example fix
// before: blindly parse
ok, _ := parseOwnerKey(key)
// after: skip malformed keys defensively
if _, err := parseOwnerKey(key); err != nil {
logger.Warnf("skip malformed owner key %q: %s", key, err)
continue
} Defensive patterns
Strategy: validation
Validate before calling
parts := strings.Split(key, "_"); if len(parts) != 2 { /* skip or repair malformed key */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- insert/update failed
- invalid dumped meta: missing 'Counters'
- The entry of the root inode was not found
- The entry of the root inode was not found
- failed to get startTS, which is required for TiKV to ensure
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/cb25c1d5369e7be8.
Report an issue: GitHub.