juicedata/juicefs · error
get session ID: %s
Error message
get session ID: %s
What it means
During NewSession, baseMeta must allocate a session ID by incrementing the `nextSession` counter in the metadata engine; if incrCounter fails, this error wraps the cause. Without a session ID the client cannot register itself, so startup fails.
Source
Thrown at pkg/meta/base.go:796
ctx := m.sessCtx
go m.refresh(ctx)
if err := m.en.cacheACLs(ctx); err != nil {
return err
}
if m.conf.ReadOnly {
logger.Infof("Create read-only session OK with version: %s", version.Version())
return nil
}
if record {
// use the original sid if it's not 0
action := "Update"
if m.sid == 0 {
v, err := m.en.incrCounter("nextSession", 1)
if err != nil {
return fmt.Errorf("get session ID: %s", err)
}
m.sid = uint64(v)
m.conf.Sid = m.sid
action = "Create"
}
if err := m.en.doNewSession(m.newSessionInfo(), action == "Update"); err != nil {
return fmt.Errorf("create session: %s", err)
}
logger.Infof("%s session %d OK with version: %s", action, m.sid, version.Version())
}
m.loadQuotas()
m.sessWG.Add(3)
go m.flushStats(ctx)
go m.flushDirStat(ctx)
go m.flushQuotas(ctx)
m.startDeleteSliceTasks() // start MaxDeletes tasksView on GitHub (pinned to c9a67b23e8)
Solutions
- Check metadata engine connectivity and health (auth, network, read-only state) and retry the mount
- Verify the client has write permission on the metadata engine (counter must be incremented)
- Inspect engine logs for the underlying incrCounter error and fix the backend
Example fix
# before: replica rejects writes juicefs mount redis://replica:6379 /jfs # after: point at primary juicefs mount redis://primary:6379 /jfs
Defensive patterns
Strategy: retry
Validate before calling
// preflight: ensure the metadata engine accepts writes // e.g. redis-cli -h host PING and confirm role:master (not read-only replica)
Try / catch
if err := meta.NewSession(); err != nil { if strings.Contains(err.Error(), "get session ID") { time.Sleep(backoff); retry(meta.NewSession) } } Prevention
- Point clients at the primary, not a read-only replica
- Monitor metadata backend health before mounts
- Use connection retries/keepalives in orchestration
When it happens
Trigger: Metadata engine unreachable or erroring when incrementing nextSession (network partition, Redis READONLY replica, SQL connection failure); corrupted counter value that cannot be incremented.
Common situations: Redis in read-only mode or out of memory; MySQL/PostgreSQL connection issues at mount time; transient network blips during mount in Kubernetes environments.
Related errors
- insert new session %d: %s
- find sustained %d: %s
- failed to clean up sid %d
- new session: %s
- create session: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/22c53f3b7d94dd86.
Report an issue: GitHub.