{"record":{"id":"23c913167ae7e368","repo":"juicedata/juicefs","slug":"json-s-23c913","errorCode":null,"errorMessage":"json: %s","messagePattern":"json: %s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/tkv.go","lineNumber":513,"sourceCode":"\t\t\t}\n\t\t\treturn limit < 0 || c < limit\n\t\t})\n\t\treturn nil\n\t}, 0)\n\treturn keys, vals, err\n}\n\nfunc (m *kvMeta) doInit(format *Format, force bool) error {\n\tbody, err := m.get(m.fmtKey(\"setting\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif body != nil {\n\t\tvar old Format\n\t\terr = json.Unmarshal(body, &old)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"json: %s\", err)\n\t\t}\n\t\tif !old.DirStats && format.DirStats {\n\t\t\t// remove dir stats as they are outdated\n\t\t\tvar keys [][]byte\n\t\t\tprefix := m.fmtKey(\"U\")\n\t\t\terr := m.client.txn(Background(), func(tx *kvTxn) error {\n\t\t\t\ttx.scan(prefix, nextKey(prefix), true, func(k, v []byte) bool {\n\t\t\t\t\tif len(k) == 9 {\n\t\t\t\t\t\tkeys = append(keys, k)\n\t\t\t\t\t}\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t\treturn nil\n\t\t\t}, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"scan dir stats\")\n\t\t\t}\n\t\t\terr = m.txn(Background(), func(tx *kvTxn) error {","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/tkv.go#L495-L531","documentation":"Returned by kvMeta.doInit when the stored volume setting value cannot be JSON-unmarshalled into a Format. The persisted format record is corrupted or was written by an incompatible version, so the client refuses to operate on it.","triggerScenarios":"Thrown at pkg/meta/tkv.go:513 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for mixed client versions writing the setting key","Restore the format record from backup or re-format if the volume is expendable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}