juicedata/juicefs · error
corrupted session info; json error: %s
Error message
corrupted session info; json error: %s
What it means
getSession reads a client session's JSON blob from the Redis hash `sessionInfos` and unmarshals it into a meta.Session. If the stored value is not valid JSON (or doesn't match the Session schema), json.Unmarshal fails and this error is returned, signaling the persisted session record is corrupted. It is thrown by both `juicefs status <mountpoint>`/session listing paths (GetSession, ListSessions).
Source
Thrown at pkg/meta/redis.go:546
})
return err
}
}, name)
return changed, err
}
func (m *redisMeta) getSession(sid string, detail bool) (*Session, error) {
ctx := Background()
info, err := m.rdb.HGet(ctx, m.sessionInfos(), sid).Bytes()
if err == redis.Nil { // legacy client has no info
info = []byte("{}")
} else if err != nil {
return nil, fmt.Errorf("HGet sessionInfos %s: %s", sid, err)
}
var s Session
if err := json.Unmarshal(info, &s); err != nil {
return nil, fmt.Errorf("corrupted session info; json error: %s", err)
}
s.Sid, _ = strconv.ParseUint(sid, 10, 64)
if detail {
inodes, err := m.rdb.SMembers(ctx, m.sustained(s.Sid)).Result()
if err != nil {
return nil, fmt.Errorf("SMembers %s: %s", sid, err)
}
s.Sustained = make([]Ino, 0, len(inodes))
for _, sinode := range inodes {
inode, _ := strconv.ParseUint(sinode, 10, 64)
s.Sustained = append(s.Sustained, Ino(inode))
}
locks, err := m.rdb.SMembers(ctx, m.lockedKey(s.Sid)).Result()
if err != nil {
return nil, fmt.Errorf("SMembers %s: %s", sid, err)
}
s.Flocks = make([]Flock, 0, len(locks)) // greedyView on GitHub (pinned to c9a67b23e8)
Solutions
- Identify the offending session id from the error, then inspect the raw value: redis-cli HGET <prefix>sessionInfos <sid> — if it's invalid JSON, the record is corrupt.
- Check which client owns the session (`juicefs status` lists sessions); if the session is stale (mount crashed long ago), remove it with `juicefs rmr --session`/`juicefs status` tooling or delete the stale session record so listing can proceed.
- Verify all JuiceFS clients in the cluster run a compatible version; upgrade older clients and remount so session info is rewritten in the current format.
- If corruption came from a bad Redis restore, restore from a healthy RDB/AOF backup.
- As a workaround, tolerate the bad record by skipping failed sessions when listing, or drop the single corrupt hash field: redis-cli HDEL <prefix>sessionInfos <sid>.
Example fix
// admin-side cleanup once the corrupt session id is known // before: juicefs status redis://... fails with "corrupted session info" // after: $ redis-cli -u redis://... HGET sessionInfos 42 # inspect $ redis-cli -u redis://... HDEL sessionInfos 42 # drop corrupt record $ juicefs status redis://... # succeeds
Defensive patterns
Strategy: validation
Validate before calling
// Check the raw session blob before relying on tooling output $ redis-cli -u "$META_URL" HGET <prefix>sessionInfos <sid> | python3 -m json.tool # exit 0 => valid JSON; error => corrupt record
Type guard
func sessionInfoLooksLikeJSON(raw []byte) bool {
var s meta.Session
return json.Unmarshal(raw, &s) == nil
} Try / catch
sess, err := metaCli.GetSession(sid, true)
if err != nil {
if strings.Contains(err.Error(), "corrupted session info") {
log.Warnf("skipping corrupt session %d: %v", sid, err)
return nil // skip and continue listing other sessions
}
return err
} Prevention
- Never hand-edit Redis keys belonging to JuiceFS; use the provided CLI commands.
- Keep all clients on a compatible JuiceFS version before rolling upgrades.
- Back up Redis (RDB/AOF) before any restore or migration.
- If a listing fails on one session, enumerate and delete just the corrupt sessionInfos hash field instead of wiping the DB.
- Monitor for crashed mounts and clean stale sessions promptly via `juicefs gc`/rmr tooling.
When it happens
Trigger: Running `juicefs status <meta-url> --session <sid>` or `juicefs status <meta-url>` (which lists all sessions via ListSessions -> getSession) when the HGET sessionInfos <sid> value in Redis is corrupt or was written by an incompatible/older client with a different JSON layout, or the key was modified/deleted externally.
Common situations: 1) Someone manually edited or trimmed Redis data (e.g. via redis-cli, or a Redis RDB/AOF restore that truncated values). 2) Mixed-version clusters where a newer client wrote fields an older reader can't parse (rare, since JSON unmarshal is forward-tolerant) or where a third-party tool rewrote the hash. 3) Non-JSON bytes in the sessionInfos hash from a broken client or external writer.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- new session: %s
- corrupted session info; json error: %s
- database %s is used by volume %s
- load setting: %s
- json: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/6533e1595ca9c6d9.
Report an issue: GitHub.