juicedata/juicefs · error

create session: %s

Error message

create session: %s

What it means

baseMeta.NewSession calls the engine's doNewSession to register session info (after obtaining a session ID); failure is wrapped as 'create session'. This error means the client could not register itself with the metadata engine and mount/startup aborts.

Source

Thrown at pkg/meta/base.go:803

	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 tasks

	if !m.conf.NoBGJob {
		m.sessWG.Add(4)
		go m.cleanupDeletedFiles(ctx)
		go m.cleanupSlices(ctx)
		go m.cleanupTrash(ctx)
		go m.symlinks.clean(ctx, &m.sessWG)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Retry the mount after checking metadata engine availability and logs for the wrapped cause
  2. Clean up stale session records (juicefs gc / session pruning) if the Update path conflicts
  3. Ensure stable network/keepalive to the metadata backend before mounting
Defensive patterns

Strategy: retry

Try / catch

if err := meta.NewSession(); err != nil { if strings.Contains(err.Error(), "create session") { log.Warnf("session create failed: %v; retrying", err); retryWithBackoff() } }

Prevention

When it happens

Trigger: doNewSession fails due to backend errors (connection lost between SID allocation and registration, key-size limits, timeouts); stale session records conflicting during 'Update' action for reused sid.

Common situations: Flaky network to Redis/SQL during mount; TiKV/etcd request size or availability issues; crash-restart loops where session cleanup didn't happen and update path fails.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/e9f1813c00ddd6b1. Report an issue: GitHub.