{"record":{"id":"e9f1813c00ddd6b1","repo":"juicedata/juicefs","slug":"create-session-s","errorCode":null,"errorMessage":"create session: %s","messagePattern":"create session: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/base.go","lineNumber":803,"sourceCode":"\tif m.conf.ReadOnly {\n\t\tlogger.Infof(\"Create read-only session OK with version: %s\", version.Version())\n\t\treturn nil\n\t}\n\n\tif record {\n\t\t// use the original sid if it's not 0\n\t\taction := \"Update\"\n\t\tif m.sid == 0 {\n\t\t\tv, err := m.en.incrCounter(\"nextSession\", 1)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"get session ID: %s\", err)\n\t\t\t}\n\t\t\tm.sid = uint64(v)\n\t\t\tm.conf.Sid = m.sid\n\t\t\taction = \"Create\"\n\t\t}\n\t\tif err := m.en.doNewSession(m.newSessionInfo(), action == \"Update\"); err != nil {\n\t\t\treturn fmt.Errorf(\"create session: %s\", err)\n\t\t}\n\t\tlogger.Infof(\"%s session %d OK with version: %s\", action, m.sid, version.Version())\n\t}\n\n\tm.loadQuotas()\n\n\tm.sessWG.Add(3)\n\tgo m.flushStats(ctx)\n\tgo m.flushDirStat(ctx)\n\tgo m.flushQuotas(ctx)\n\tm.startDeleteSliceTasks() // start MaxDeletes tasks\n\n\tif !m.conf.NoBGJob {\n\t\tm.sessWG.Add(4)\n\t\tgo m.cleanupDeletedFiles(ctx)\n\t\tgo m.cleanupSlices(ctx)\n\t\tgo m.cleanupTrash(ctx)\n\t\tgo m.symlinks.clean(ctx, &m.sessWG)","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/base.go#L785-L821","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the mount after checking metadata engine availability and logs for the wrapped cause","Clean up stale session records (juicefs gc / session pruning) if the Update path conflicts","Ensure stable network/keepalive to the metadata backend before mounting"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := meta.NewSession(); err != nil { if strings.Contains(err.Error(), \"create session\") { log.Warnf(\"session create failed: %v; retrying\", err); retryWithBackoff() } }","preventionTips":["Ensure stable connectivity to the metadata engine at mount time","Clean up stale sessions after crash loops (juicefs gc / status)","Watch backend logs for request-size or timeout limits (etcd/TiKV)"],"tags":["session","metadata","startup"],"backgroundTag":"database-write-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}