juicedata/juicefs · warning
invalid key %s, fail to parse size
Error message
invalid key %s, fail to parse size
What it means
Same GC pending-slice scan as the "fail to parse id" error, but here the size portion of a "<id>_<size>" pending-slice key could not be parsed with strconv.ParseUint. The library throws it because a slice size must be a valid uint64 to delete or scan the slice; a malformed size means the key is corrupt or foreign.
Source
Thrown at pkg/meta/redis.go:4198
}
}
return nil
})
close(pendingKeys)
}()
for key := range pendingKeys {
ps := strings.Split(key[1:], "_")
if len(ps) != 2 {
return fmt.Errorf("invalid key %s", key)
}
id, err := strconv.ParseUint(ps[0], 10, 64)
if err != nil {
return errors.Wrapf(err, "invalid key %s, fail to parse id", key)
}
size, err := strconv.ParseUint(ps[1], 10, 64)
if err != nil {
return errors.Wrapf(err, "invalid key %s, fail to parse size", key)
}
clean, err := scan(id, uint32(size))
if err != nil {
return errors.Wrap(err, "scan pending slices")
}
if clean {
// TODO: m.deleteSlice(id, uint32(size))
// avoid lint warning
_ = clean
}
}
return nil
}
func (m *redisMeta) scanPendingFiles(ctx Context, scan pendingFileScan) error {
if scan == nil {
return nil
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Inspect and remove the malformed key via redis-cli (key name is in the message).
- Verify no other applications share the Redis DB with JuiceFS.
- Re-run `juicefs gc` after cleaning the keyspace.
- Check for interrupted upgrades between JuiceFS versions that changed pending-slice encoding.
Defensive patterns
Strategy: validation
Validate before calling
// Validate the size component of a pending-slice key before GC processes it:
parts := strings.Split(key, "_")
if len(parts) == 2 {
if _, err := strconv.ParseUint(parts[1], 10, 64); err != nil { /* corrupt */ }
} Type guard
func validSliceSize(key string) bool {
i := strings.LastIndex(key, "_")
if i < 0 { return false }
_, err := strconv.ParseUint(key[i+1:], 10, 64)
return err == nil
} Try / catch
if err := gc(); err != nil {
if strings.Contains(err.Error(), "fail to parse size") {
logger.Warnf("skipping malformed pending slice: %v", err)
return nil
}
return err
} Prevention
- Keep the Redis keyspace exclusive to JuiceFS.
- Avoid manual key manipulation with redis-cli.
- Run GC after upgrades, not during them.
- Back up Redis before bulk cleanup operations.
When it happens
Trigger: `juicefs gc` scanPendingSlices encounters a key whose second underscore-separated segment is not a decimal uint64 (e.g. "123_abc"), after the id segment parsed successfully.
Common situations: Corrupted or manually inserted Redis keys; data from an incompatible older key encoding; external tools writing into the JuiceFS keyspace.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- invalid key %s, fail to parse id
- scan trash slices: %s
- scan pending slices
- invalid key %s
- invalid key %s, fail to parse timestamp
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/511be2e92105cd08.
Report an issue: GitHub.