{"record":{"id":"c065a1a200799100","repo":"juicedata/juicefs","slug":"version-is-nil","errorCode":null,"errorMessage":"version is nil","messagePattern":"version is nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/config.go","lineNumber":181,"sourceCode":"func (f *Format) String() string {\n\tt := *f\n\tt.RemoveSecret()\n\ts, _ := json.MarshalIndent(t, \"\", \"  \")\n\treturn string(s)\n}\n\nfunc (f *Format) CheckVersion() error {\n\tif f.MetaVersion > MaxVersion {\n\t\treturn fmt.Errorf(\"incompatible metadata version: %d; please upgrade the client\", f.MetaVersion)\n\t}\n\n\tver := version.GetVersion()\n\treturn f.CheckCliVersion(&ver)\n}\n\nfunc (f *Format) CheckCliVersion(ver *version.Semver) error {\n\tif ver == nil {\n\t\treturn errors.New(\"version is nil\")\n\t}\n\n\tif f.MinClientVersion != \"\" {\n\t\tminClientVer := version.Parse(f.MinClientVersion)\n\t\tr, err := version.CompareVersions(ver, minClientVer)\n\t\tif err == nil && r < 0 {\n\t\t\terr = fmt.Errorf(\"allowed minimum version: %s; please upgrade the client\", f.MinClientVersion)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif f.MaxClientVersion != \"\" {\n\t\tmaxClientVer := version.Parse(f.MaxClientVersion)\n\t\tr, err := version.CompareVersions(ver, maxClientVer)\n\t\tif err == nil && r > 0 {\n\t\t\terr = fmt.Errorf(\"allowed maximum version: %s; please use an older client\", f.MaxClientVersion)\n\t\t}","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/config.go#L163-L199","documentation":"CheckCliVersion rejects a nil client version pointer. It compares the running client's semver against the volume format's MinClientVersion; if the passed version is nil there is nothing to compare, so it returns this error.","triggerScenarios":"Calling Format.CheckCliVersion(nil), or indirectly CheckVersion when version.GetVersion() yields a nil pointer (abnormal/uninitialized version info).","commonSituations":"Embedding juicefs as a library and passing an uninitialized *version.Semver; builds with stripped version metadata producing an unset version.","solutions":["Initialize the version properly: pass &version.Semver from version.GetVersion() and ensure build-time version variables are set.","Guard callers so they never call CheckCliVersion with a nil pointer.","If embedding, hard-code a valid Semver matching the client build."],"exampleFix":"// before\nvar ver *version.Semver\nerr := format.CheckCliVersion(ver)\n// after\nv := version.GetVersion()\nerr := format.CheckCliVersion(&v)","handlingStrategy":"validation","validationCode":"func safeCheckVersion(f *meta.Format) error {\n\tv := version.GetVersion()\n\tif v == nil { return errors.New(\"client version unavailable\") }\n\treturn f.CheckCliVersion(&v)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass a nil *version.Semver to CheckCliVersion","Ensure build embeds version info (ldflags)","Guard library callers against uninitialized version"],"tags":["version","validation","client"],"backgroundTag":"null-argument","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"}